Metiocre7,8- Dai vs btc and eth
Updated 2022-05-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 btc as (SELECT
trunc(hour,'day') as date,
avg(price) as token_price,
token_price - LAG(token_price, 1) OVER (ORDER BY date) AS change
from flipside_prod_db.ethereum_core.fact_hourly_token_prices
where symbol = 'WBTC' --address_name = 'maker'
and date>='2022-01-01'
group by date
),
eth as (SELECT
trunc(hour,'day') as date,
avg(price) as token_price,
token_price - LAG(token_price, 1) OVER (ORDER BY date) AS change
from flipside_prod_db.ethereum_core.fact_hourly_token_prices
where symbol = 'WETH' --address_name = 'maker'
and date>='2022-01-01'
group by date
),
dai_on_market as (
select
balance_date as date,
sum(balance) as dai_on_market,
dai_on_market - LAG(dai_on_market,1) OVER(order by date) as change
from flipside_prod_db.ethereum.erc20_balances
where date>='2022-01-01' and contract_address='0x6b175474e89094c44da98b954eedeac495271d0f'
group by 1
)
SELECT d.date,
d.change as dai_on_market_change,
b.token_price as btc_price,
b.change as btc_change,
e.token_price as eth_price,
e.change as eth_change
FROM dai_on_market d join btc b on d.date=b.date join eth e on d.date=e.date
Run a query to Download Data