Query editor
with fee as (select tx_id, from_owner as walletfrom tokens_solana.transferswhere to_owner = 'R4rNJHaffSUotNmqSKNEfDcJE8A7zJUkaoM5Jkd7cYX'and token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'and block_date between date '2026-05-20' and date '2026-07-31'),cohort as (select distinct wallet from fee),fomo_txs as (select distinct tx_id from fee),flows as (select t.from_owner, t.to_owner, t.token_mint_address as mint,t.amount_display as qty, t.amount_usd as usdfrom tokens_solana.transfers tjoin fomo_txs f on f.tx_id = t.tx_idwhere t.block_date between date '2026-05-20' and date '2026-07-31'and t.to_owner <> 'R4rNJHaffSUotNmqSKNEfDcJE8A7zJUkaoM5Jkd7cYX'),legs as (select c.wallet, f.mint, f.qty as qty, f.usd as usdfrom flows f join cohort c on c.wallet = f.to_ownerunion allselect c.wallet, f.mint, -f.qty, -f.usdfrom flows f join cohort c on c.wallet = f.from_owner),early as (select wallet, mint, sum(qty) as net_qty, sum(usd) as net_usdfrom legs group by 1, 2),all_net as (select wallet, mint, sum(net_qty) as net_qty, sum(net_usd) as net_usdfrom (select wallet, mint, net_qty, net_usd from earlyunion allselect wallet, mint, net_qty, net_usd from dune.crypto_edgar.result_fomo_sol_net_2026_08) ugroup by 1, 2),px as (select mint, sum(usd) / nullif(sum(qty), 0) as pricefrom (select token_bought_mint_address as mint, token_bought_amount as qty, amount_usd as usdfrom dex_solana.tradeswhere block_month = date '2026-08-01'and block_date between date '2026-08-17' and date '2026-08-18'and amount_usd > 0 and token_bought_amount > 0union allselect token_sold_mint_address, token_sold_amount, amount_usdfrom dex_solana.tradeswhere block_month = date '2026-08-01'and block_date between date '2026-08-17' and date '2026-08-18'and amount_usd > 0 and token_sold_amount > 0) sgroup by 1),quotes(qmint) as (values('So11111111111111111111111111111111111111112'),('So11111111111111111111111111111111111111111'),('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')),w as (