with swaps as (select
date_trunc('day',block_timestamp) as date,
token_out,
count(distinct trader) as trader,
count(distinct tx_hash) as swaps,
sum(amount_in) as near_volume,
row_number() over (partition by date order by (swaps) desc ) as row_number
from near.core.ez_dex_swaps where token_in in ('wNEAR','NEAR')
GROUP BY date,token_out
ORDER BY date )
select * from swaps where row_number <= 10
order by date