negin-khThe volume of ETH swaps before and after the Merge
Updated 2022-09-30
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
›
⌄
with base as (
select distinct miner from ethereum.core.fact_blocks
where BLOCK_TIMESTAMP>='2022-01-01'
),
price as (
select
date_trunc(day,hour) as days,
avg(PRICE) as price from
ethereum.core.fact_hourly_token_prices
where symbol ilike 'weth' group by 1
)
select
date_trunc(day,block_timestamp)::date as days,
case when block_timestamp >= '2022-09-15' and block_number >= 15537394 then 'post merge' else 'pre merge' end as type,
--case when token_in = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
count(distinct ORIGIN_FROM_ADDRESS) as tot_swappers,
price,
count(distinct TX_HASH) as tot_swaps,
sum(amount_in_usd) as swap_volume,
avg(amount_in_usd) as avg_swap_volume,
tot_swaps/tot_swappers as swaps_per_swapper
from ethereum.core.ez_dex_swaps s, price p
where EVENT_name = 'Swap' and p.days = s.block_timestamp::date
and block_timestamp between '2022-08-15' and CURRENT_date - 1
and symbol_out = 'WETH'
and amount_out_usd > 0 and amount_out_usd is not null
and ORIGIN_FROM_ADDRESS in (select miner from base )
group by 1,2,price
Run a query to Download Data