strawbettyTotal swap numbers
Updated 2022-05-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
25
26
27
28
29
30
31
32
33
34
35
›
⌄
with swap_in as
(
select
count(tx_id) as swap_in_count,
sum(amount_usd) as amount_usd_in,
date_trunc('day', block_timestamp) as day
from ethereum.dex_swaps
where platform like 'sushiswap'
and direction = 'IN'
and amount_usd >= {{x}}
group by day
),
swap_out as
(
select
count(tx_id) as swap_out_count,
sum(amount_usd) as amount_usd_out,
date_trunc('day', block_timestamp) as day
from ethereum.dex_swaps
where platform like 'sushiswap'
and direction = 'OUT'
and amount_usd >= {{x}}
group by day
)
select i.day as dt,
swap_in_count,
swap_out_count,
sum(swap_in_count+swap_out_count) over (order by dt) as total_swap_count,
amount_usd_in,
amount_usd_out,
sum(amount_usd_in+amount_usd_out) over (order by dt) as total_swap_volume
from swap_in as i left join swap_out as o on i.day = o.day
order by 1 desc
Run a query to Download Data