Query editor
with cls as (select mint, cls, issuer from query_9221018),trades as (select block_date d, tx_id, outer_instruction_index, project_program_id pool, token_sold_mint_address sold_mint, token_bought_mint_address bought_mint,amount_usd, cast(token_sold_amount_raw as double) sold_raw, cast(token_bought_amount_raw as double) bought_raw,row_number() over (partition by tx_id, outer_instruction_index order by inner_instruction_index) swap_numberfrom dex_solana.tradeswhere block_month = date '2026-11-01' and block_date between date '2026-11-10' and date '2026-11-23' and project = 'meteora' and version = 2),pool_prices as (select d, pool, mint, sum(amount_usd) / sum(raw) usd_per_raw from (select d, pool, sold_mint mint, amount_usd, sold_raw raw from tradesunion all select d, pool, bought_mint, amount_usd, bought_raw from trades)where amount_usd > 0 and raw > 0 group by 1, 2, 3),pool_mints as (select account_lb_pair pool, max(account_token_x_mint) token_x, max(account_token_y_mint) token_y from (select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap_exact_out where call_block_date between date '2026-11-10' and date '2026-11-23'union all select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap_exact_out2 where call_block_date between date '2026-11-10' and date '2026-11-23'union all select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap_with_price_impact where call_block_date between date '2026-11-10' and date '2026-11-23'union all select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap_with_price_impact2 where call_block_date between date '2026-11-10' and date '2026-11-23'union all select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap where call_block_date between date '2026-11-10' and date '2026-11-23'union all select account_lb_pair, account_token_x_mint, account_token_y_mint from dlmm_solana.lb_clmm_call_swap2 where call_block_date between date '2026-11-10' and date '2026-11-23') where account_lb_pair is not null group by 1),events as (select evt_block_date d, evt_tx_id tx_id, coalesce(evt_outer_instruction_index, 0) outer_instruction_index, lb_pair pool, swap_for_y, amount_in,row_number() over (partition by evt_tx_id, coalesce(evt_outer_instruction_index, 0) order by coalesce(evt_inner_instruction_index, 0)) swap_numberfrom dlmm_solana.lb_clmm_evt_swap2evtwhere evt_block_date between date '2026-11-10' and date '2026-11-23' and evt_inner_executing_account = 'LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo'),extra as (select e.pool, sum(cast(e.amount_in as double) * p.usd_per_raw) vol_extrafrom events eleft join trades t on t.tx_id = e.tx_id and t.outer_instruction_index = e.outer_instruction_index and t.swap_number = e.swap_numberleft join pool_mints m on m.pool = e.poolleft join pool_prices p on p.pool = e.pool and p.d = e.d and p.mint = (case when e.swap_for_y then m.token_x else m.token_y end)where t.tx_id is null group by 1),tp as (select pool, sum(amount_usd) vol, min(sold_mint) ma, max(sold_mint) mb, min(bought_mint) mc, max(bought_mint) md from trades group by 1),allp as (select coalesce(tp.pool, x.pool) pool, tp.vol, x.vol_extra,coalesce(pm.token_x, least(tp.ma, tp.mc)) m1, coalesce(pm.token_y, greatest(tp.mb, tp.md)) m2from tp full outer join extra x on x.pool = tp.poolleft join pool_mints pm on pm.pool = coalesce(tp.pool, x.pool))select a.pool,case when c1.cls is null or c2.cls is null then 'meme'when 'rwa' in (c1.cls, c2.cls) then (case when c1.issuer is not null and c2.issuer is not null and c1.issuer <> c2.issuer then 'rwa_both' when coalesce(c1.issuer, c2.issuer) = 'xStocks' then 'rwa_x' else 'rwa_b' end)when 'main' in (c1.cls, c2.cls) then 'main' else 'stable' end typ,coalesce(a.vol,0) vol_trades, coalesce(a.vol_extra,0) vol_extrafrom allp a left join cls c1 on c1.mint = a.m1 left join cls c2 on c2.mint = a.m2where coalesce(a.vol,0) + coalesce(a.vol_extra,0) > 0