rackhaelNEAR swaps
Updated 2022-11-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
›
⌄
-- inspired by https://app.flipsidecrypto.com/dashboard/what-are-users-swapping-g-algo-3-for-kIJfZM
with swaps_to as (
select block_timestamp::date as fecha,
--swap_program as dex,
count (tx_hash) as swaps,
sum(amount_in) as volume
from near.core.ez_dex_swaps
where token_in_contract = 'wrap.near'
group by 1
),
swaps_from as (
select block_timestamp::date as fecha,
--swap_program as dex,
count (tx_hash) as swaps,
sum(amount_out) as volume
from near.core.ez_dex_swaps
where token_out_contract = 'wrap.near'
group by 1
)
select sto.fecha as days,
sto.swaps as swaps_to,
sum(swaps_to) over (order by days) as cum_swaps_to,
sto.volume as volume_to,
sum(volume_to) over (order by days) as cum_volume_to,
sfrom.swaps as swaps_from,
sum(swaps_from) over (order by days) as cum_swaps_from,
sfrom.volume as volume_from,
sum(volume_from) over (order by days) as cum_volume_from
from swaps_to sto
inner join swaps_from sfrom
on sto.fecha = sfrom.fecha
order by days desc
Run a query to Download Data