Query editor
withbuy as (select distinct trader_id, sum(amount_usd) as boughtfrom dex_solana.tradeswheretoken_bought_mint_address = '{{token_address}}'and block_time > (current_date - interval '7' day)and amount_usd > 999group by trader_id), sell as (select distinct trader_id, sum(amount_usd) as soldfrom dex_solana.tradeswheretoken_sold_mint_address = '{{token_address}}'and block_time > (current_date - interval '7' day)group by trader_id), accum as (select b.trader_id as trader, b.bought as amountfrom buy bleft join sell son s.trader_id = b.trader_idwhere s.sold is nullgroup by b.trader_id, b.boughtorder by b.bought desc), total_accum_traders as (select count(trader) from accum), total_accum_amount as (select sum(amount) from accum)select*from accumcross join total_accum_traderscross join total_accum_amountorder by amount desc