Query editor
/*What percentage of volume that is routed through Uniswap frontend flows through Uniswap X?Total Uniswap volume includes multihop txs e.g. see 0x50ee3ea7cc969dd1f6f3dad2d040590cc501c127e7ddaef788a93116d7a57285*/with total_vol as (select sum(amount_usd) as total_vol_usd, token_pair, week(block_time) as week from dune.flashbots.result_overall_lq_alltimewhere frontend in ('Uniswap Website: Uniswap X ON', 'Uniswap Website & Wallet: Default')and block_time > date('{{starting_date}}')and date_trunc('month', block_time) < date('{{ending_date}}')group by 2,3),uniswapx_vol as (select sum(amount_usd) as uniswapx_vol_usd, token_pair, week(block_time) as week from dune.flashbots.result_overall_lq_alltimewhere frontend = 'Uniswap Website: Uniswap X ON'and block_time > date('{{starting_date}}')and date_trunc('month', block_time) < date('{{ending_date}}')group by 2,3),ranking as (select *, row_number() over (partition by week order by uniswapx_vol_usd desc) as "rank" from (select (u.uniswapx_vol_usd/t.total_vol_usd) * 100 as percentage, u.token_pair, u.week, u.uniswapx_vol_usd from uniswapx_vol uleft join total_vol t on t.token_pair = u.token_pair and t.week = u.week))select * from ranking where "rank" <= 20order by week desc, uniswapx_vol_usd desc