rajsNear Swaps By Month
Updated 2022-11-04Copy Reference Fork
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
with swaps as
(
SELECT
date_trunc('month', block_timestamp) as date,
trader,
count(distinct tx_hash) as no_of_swaps,
row_number() over (partition by date_trunc('month', block_timestamp) order by count(distinct tx_hash) desc) as rank
from near.core.ez_dex_swaps
group by 1,2
order by 1, 3 desc
)
SELECT
-- *,
date,
case when rank <= 10 then 'Top 10' else 'Others' end as category,
sum(no_of_swaps) as no_of_swaps
from swaps
group by 1,2
order by 1,3 desc
Run a query to Download Data