Abolfazl_771025User categorize by count of swap
Updated 2022-12-07
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
›
⌄
with main as (select
DISTINCT ORIGIN_FROM_ADDRESS as users,
count(distinct tx_hash) as "count of swap",
sum(AMOUNT_out_USD) as "volume (USD) of swap"
from ethereum.core.ez_dex_swaps
where TOKEN_out = lower('0x4d224452801ACEd8B2F0aebE155379bb5D594381')
and AMOUNT_out_USD is not null
group by 1
union
select
DISTINCT ORIGIN_to_ADDRESS as users,
count(distinct tx_hash) as "count of swap",
sum(AMOUNT_in_USD) as "volume (USD) of swap"
from ethereum.core.ez_dex_swaps
where TOKEN_in = lower('0x4d224452801ACEd8B2F0aebE155379bb5D594381')
and AMOUNT_in_USD is not null
group by 1)
select
case
when "count of swap" = 1 then 'swap just one time'
when "count of swap" between 2 and 5 then 'swap 2 - 5 time'
when "count of swap" between 6 and 10 then 'swap 6 - 10 time'
when "count of swap" between 11 and 20 then 'swap 11 - 20 time'
when "count of swap" between 21 and 50 then 'swap 21 - 50 time'
when "count of swap" between 51 and 100 then 'swap 51 - 100 time'
when "count of swap" between 101 and 200 then 'swap 101 - 200 time'
when "count of swap" between 201 and 500 then 'swap 201 - 500 time'
when "count of swap" between 501 and 1000 then 'swap 501 - 1000 time'
else 'swap more than 1000 time'
end as "swap count",
count(users) as "count of swappers"
from main
group by 1
Run a query to Download Data