hessDaily Swap Net Volume Vs. ETH Price
Updated 2023-01-20
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 eth as ( select 'ETH' as token , date(HOUR) as date, avg(price) as eth_price
from ethereum.core.fact_hourly_token_prices
where date >= '2023-01-01'
and symbol = 'WETH'
group by 1,2)
,
swap as ( select 'To ETH' as type, date(block_timestamp) as date, count(DISTINCT(origin_from_address))as toatl_user,
count(DISTINCT(tx_hash)) as total_swap, sum(amount_in_Usd) as volume, avg(amount_in_usd) as avg_volume
from ethereum.core.ez_dex_swaps
where date >= '2023-01-01'
and SYMBOL_OUT = 'WETH'
group by 1,2
UNION
select 'From ETH' as type, date(block_timestamp) as date, count(DISTINCT(origin_from_address)) as toatl_user,
count(DISTINCT(tx_hash)) as total_swap, sum(amount_in_Usd) as volume, avg(amount_in_usd) as avg_volume
from ethereum.core.ez_dex_swaps
where date >= '2023-01-01'
and SYMBOL_IN = 'WETH'
and amount_in_usd < 60000000
group by 1,2)
,
swaps as ( select b.date, eth_price , type, toatl_user, total_swap, volume, avg_volume
from eth a left outer join swap b on a.date = b.date)
,
from_ as ( select *
from swaps
where type = 'From ETH')
,
to_ as ( select *
from swaps
where type = 'To ETH')
select a.date, a.volume-b.volume as net, a.eth_price
from to_ a left outer join from_ b on a.date = b.date
Run a query to Download Data