MLDZMNxdai13
Updated 2023-03-06
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
›
⌄
select
date_trunc('{{Time_basis}}', BLOCK_TIMESTAMP) as date,
count(distinct tx_hash) as swaps,
count(distinct SENDER) as swappers,
count(distinct case when TOKEN_IN ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F' then tx_hash end ) as swap_in_count,
sum(swap_in_count)over(order by date ) as cum_swap_in_count,
count(distinct case when TOKEN_out ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F' then tx_hash end ) as swap_out_count,
sum(swap_out_count)over(order by date ) as cum_swap_out_count,
sum(case when TOKEN_IN ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F' then AMOUNT_IN_USD end ) as swap_in_usd,
sum(swap_in_usd)over(order by date ) as cum_swap_in_usd,
sum(case when TOKEN_OUT ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F' then AMOUNT_OUT_USD end ) as swap_out_usd,
sum(swap_out_usd)over(order by date ) as cum_swap_out_usd,
(swap_out_usd - swap_in_usd ) as net_volume_usd
from
ethereum.core.ez_dex_swaps
where
(TOKEN_IN ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F'
or
TOKEN_OUT ilike '0x6B175474E89094C44Da98b954EedeAC495271d0F')
and BLOCK_TIMESTAMP>=CURRENT_DATE- {{Time_period_days}}
group by 1
Run a query to Download Data