mboveiriETH Derivatives 4
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(liquidated_amount) as steth_liq_volume
from ethereum.aave.ez_liquidations
where collateral_asset = lower('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
and date >= current_date - 200
group by 1
)
Run a query to Download Data