nitsWETH vs WBTC Prices
Updated 2022-11-23
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 prices as
(SELECT date(hour) as day, avg(price) as avg_price
from ethereum.core.fact_hourly_token_prices
where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
GROUP by 1
),
prices1 as
(SELECT date(hour) as day_, avg(price) as avg_price_
from ethereum.core.fact_hourly_token_prices
where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
GROUP by 1
),
eth as
(SELECT *, (avg_price-avg_price_)/avg_price_ *100 as percent_change,'WETH' as token,
(avg_price-(SELECT avg_price from prices where day= CURRENT_DATE - {{n_last_days}} ))/avg_price_ *100 as percent_change_cumulative
from prices
inner join prices1 on day = day_ + 1),
prices_ as
(SELECT date(hour) as day, avg(price) as avg_price
from ethereum.core.fact_hourly_token_prices
where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WBTC'
GROUP by 1
),
prices1_ as
(SELECT date(hour) as day_, avg(price) as avg_price_
from ethereum.core.fact_hourly_token_prices
where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WBTC'
GROUP by 1
),
wbtc as
(SELECT *, (avg_price-avg_price_)/avg_price_ *100 as percent_change,'WBTC' as token,
(avg_price-(SELECT avg_price from prices_ where day= CURRENT_DATE - {{n_last_days}} ))/avg_price_ *100 as percent_change_cumulative
from prices_
inner join prices1_ on day = day_ + 1)
Run a query to Download Data