mboveiriETH Derivatives 3
Updated 2022-09-13
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
36
›
⌄
with etd as
(select
date_trunc('day',a.hour) as date,
--a.hour,
avg(a.price) as ETH,
avg(b.price) as stETH,
avg(c.price) as rETH,
avg(d.price) as aETH,
stETH/ETH-1 as stETH_peg,
rETH/ETH-1 as rETH_peg,
aETH/ETH-1 as atETH_peg,
case when date between '2022-05-06' and '2022-07-01' then 'Terra Crisis' else 'Normal' end as type
from ethereum.core.fact_hourly_token_prices a
join ethereum.core.fact_hourly_token_prices b on a.hour = b.hour
join ethereum.core.fact_hourly_token_prices c on a.hour = c.hour
join ethereum.core.fact_hourly_token_prices d on a.hour = d.hour
where a.symbol in ('WETH')
and b.token_address = lower('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
and c.token_address = lower('0xae78736cd615f374d3085123a210448e74fc6393')
and d.token_address = lower('0xe95a203b1a91a908f9b9ce46459d101078c2c3cb')
and year(a.hour) = '2022'
--and date >= current_date - 30
group by 1
),
stetha as (
select
DATE_TRUNC('day',block_timestamp::date) as date,
sum(amount0_adjusted) as steth_volume
from ethereum.uniswapv3.ez_lp_actions
where token0_address = lower('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
and date >= current_date - 200
and action = 'DECREASE_LIQUIDITY'
and amount0_adjusted != 0
group by 1
)
Run a query to Download Data