Query editor
withfluid_dex_swaps as (select *from "query_4727837(blockchain='{{blockchain}}')"), taker_excl as (select *from "query_5254724"), trading_volume_wo_fluid as (selectt.block_date as day, t.blockchain, t.project as dex, sum(t.amount_usd) as volume_usdfrom dex.trades as tleft join taker_excl as eon t.taker = e.takerand t.blockchain = e.blockchainwhere t.block_time >= timestamp '{{from_ts}}'and t.blockchain = '{{blockchain}}'and t.project <> 'fluid'and e.taker is null -- exclude outliersgroup by 1, 2, 3)-- , trading_volume_wo_fluid as (-- select-- vp.day-- , vp.blockchain-- , case-- -- when vp.dex = 'fluid' then vp.dex-- when rnk > 9 then 'others'-- else vp.dex-- end as dex-- , sum(vp.volume_usd) as volume_usd-- from (-- select-- t.block_date as day-- , t.blockchain-- , t.project as dex-- , sum(t.amount_usd) as volume_usd-- from dex.trades as t-- where t.block_date >= timestamp '{{from_ts}}'-- and t.blockchain = '{{blockchain}}'-- and t.project <> 'fluid'-- group by 1, 2, 3 ) as vp-- inner join (-- select *-- , dense_rank() over (partition by blockchain order by volume_usd desc) as rnk-- from (-- select-- t.blockchain-- , t.project as dex-- , sum(t.amount_usd) as volume_usd-- from dex.trades as t