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-08-01' and date '2026-08-18'),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-08-01' and date '2026-08-18'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)select wallet, mint, sum(qty) as net_qty, sum(usd) as net_usdfrom legsgroup by 1, 2