Eman-RazTop 5 Swapped Tokens By Transaction
Updated 2024-09-10
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
›
⌄
with tab3 as (with tab1 as (select SYMBOL_IN as "Token", count(distinct tx_hash) as "Selling Count",
count(distinct swapper) as "Seller Count", sum(amount_in_usd) as "Selling Volume"
from aptos.defi.ez_dex_swaps
where platform='liquidswap'
and block_timestamp::date between '{{Start_Date}}' and '{{End_Date}}'
and amount_in_usd is not null
group by 1),
tab2 as (select SYMBOL_out as "Token", count(distinct tx_hash) as "Buying Count",
count(distinct swapper) as "Buyer Count", sum(amount_out_usd) as "Buying Volume"
from aptos.defi.ez_dex_swaps
where platform='liquidswap'
and block_timestamp::date between '{{Start_Date}}' and '{{End_Date}}'
and amount_out_usd is not null
group by 1)
select tab1."Token" as "Token",
case when "Selling Count" is null then '0' else "Selling Count" end as "Selling Count",
case when "Buying Count" is null then '0' else "Buying Count" end as "Buying Count",
case when "Seller Count" is null then '0' else "Seller Count" end as "Seller Count",
case when "Buyer Count" is null then '0' else "Buyer Count" end as "Buyer Count",
case when "Selling Volume" is null then '0' else "Selling Volume" end as "Selling Volume ($USD)",
case when "Buying Volume" is null then '0' else "Buying Volume" end as "Buying Volume ($USD)"
from tab1 left join tab2 on tab1."Token"=tab2."Token")
select "Token", "Selling Count"+"Buying Count" as "Swap Count", "Selling Count", "Buying Count",
"Seller Count", "Buyer Count",
"Selling Volume ($USD)"+"Buying Volume ($USD)" as "Swap Volume ($USD)", "Selling Volume ($USD)", "Buying Volume ($USD)"
from tab3
order by 2 desc
LIMIT 5
QueryRunArchived: QueryRun has been archived