Query editor
WITH wallet_activity AS (SELECTtoken_bought_mint_address AS wallet_address,COUNT(*) AS tx_count,SUM(amount_usd) AS 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')GROUP BY 1UNION ALLSELECTtoken_sold_mint_address AS wallet_address,COUNT(*) AS tx_count,SUM(amount_usd) AS 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')GROUP BY 1)SELECTwallet_address,SUM(tx_count) as total_transactions,SUM(volume_usd) as total_volume_usd,AVG(avg_trade_size) as avg_trade_sizeFROM wallet_activityWHERE wallet_address IS NOT NULLGROUP BY 1ORDER BY total_transactions DESCLIMIT 10