with maintable as (
select block_timestamp::date as date,
token1_symbol,
count (distinct tx_hash) as Swaps_Count,
count (distinct recipient) as Swappers_Count,
abs (sum (amount1_usd)) as Total_Volume,
abs (avg (amount1_usd)) as Average_Volume
from ethereum.uniswapv3.ez_swaps
where block_timestamp >= CURRENT_DATE - 30
group by 1,2),
finaltable as (
select *,
row_number() over (partition by date order by Swaps_Count desc) as RN
from maintable)
select * from finaltable
where RN <= 10
order by date