c2ctrader04- Collateral Impact
Updated 2022-05-18
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
eth_volatility as (
select
hour,
price,
stddev(price) over(order by hour rows between 168 preceding and current row) as volatility
from ethereum.token_prices_hourly
where symbol = 'WETH'
and hour >= dateadd('year',-1,current_date)
),
dai_balances as (
select
balance_date,
sum(balance) as dai_balances,
sum(amount_usd) as dai_usd_balances
from ethereum.erc20_balances
where
symbol = 'DAI'
and balance_date>=dateadd('year',-1,current_date)
group by balance_date
),
maker_collaterals as (
select
date(block_timestamp) as date,
count(tx_id) as ntx,
sum(amount) asamount_asset,
sum(amount_usd) as usd_amount_assets
from ethereum.udm_events
where
( event_type ='erc20_transfer' or event_type = 'native_eth') and
to_label='maker'
and amount_usd is not null
and date>=dateadd('year',-1,current_date)
group by date
)
Run a query to Download Data