Query editor
WITH whale_activity AS (SELECTtoken_bought_mint_address AS address,COUNT(*) AS num_transactions,SUM(amount_usd) AS total_volume_usd,AVG(CASEWHEN token_bought_symbol = 'BONK' THEN token_bought_amountELSE token_sold_amountEND) AS avg_trade_sizeFROM dex_solana.tradesWHERE (token_bought_symbol = 'BONK' OR token_sold_symbol = 'BONK')AND amount_usd > 1000 -- Minimum threshold for whale tradesGROUP BY 1UNION ALLSELECTtoken_sold_mint_address AS address,COUNT(*) AS num_transactions,SUM(amount_usd) AS total_volume_usd,AVG(CASEWHEN token_bought_symbol = 'BONK' THEN token_bought_amountELSE token_sold_amountEND) AS avg_trade_sizeFROM dex_solana.tradesWHERE (token_bought_symbol = 'BONK' OR token_sold_symbol = 'BONK')AND amount_usd > 1000GROUP BY 1)SELECTaddress,SUM(num_transactions) as total_transactions,SUM(total_volume_usd) as total_volume_usd,AVG(avg_trade_size) as avg_trade_sizeFROM whale_activityWHERE address IS NOT NULLGROUP BY 1HAVING SUM(total_volume_usd) > 100000 -- Whale threshold $100kORDER BY total_volume_usd DESCLIMIT 20