Query editor
WITH swaps AS (SELECTtaker AS trader,tx_hash,amount_usd,CASEWHEN token_bought_address = 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82 THEN amount_usdWHEN token_sold_address = 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82 THEN -amount_usdEND AS signed_usdFROM dex.tradesWHERE blockchain = 'base'AND project = 'aerodrome'AND (token_bought_address = 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82OR token_sold_address = 0x311935Cd80B76769bF2ecC9D8Ab7635b2139cf82)AND amount_usd IS NOT NULL),wallet_stats AS (SELECTtrader,SUM(amount_usd) AS total_volume_usd,SUM(signed_usd) AS net_flow_usd,COUNT(DISTINCT tx_hash) AS transaction_countFROM swapsGROUP BY trader)SELECTtrader,total_volume_usd,net_flow_usd,transaction_count,-- This calculates the % of all SOL volume on Aerodrome for each wallet100.0 * total_volume_usd / SUM(total_volume_usd) OVER () AS percent_of_total_volumeFROM wallet_statsORDER BY total_volume_usd DESCLIMIT 10;