adriaparcerisasgroundhog day 2.2
Updated 2023-01-17
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
btc_price as (
select
trunc(hour,'day') as date,
avg(price) as btc_price,
LAG(btc_price,1) IGNORE NULLS OVER (ORDER BY date) as last_price,
((btc_price-last_price)/btc_price)*100 as btc_price_change
from ethereum.core.fact_hourly_token_prices where symbol='WBTC' and hour>=CURRENT_DATE-365
group by 1
),
eth_price as (
select
trunc(hour,'day') as date,
avg(price) as eth_price,
LAG(eth_price,1) IGNORE NULLS OVER (ORDER BY date) as last_price,
((eth_price-last_price)/eth_price)*100 as eth_price_change
from ethereum.core.fact_hourly_token_prices where symbol='WETH' and hour>=CURRENT_DATE-365
group by 1
),
bnb_price as (
select
trunc(hour,'day') as date,
avg(price) as bnb_price,
LAG(bnb_price,1) IGNORE NULLS OVER (ORDER BY date) as last_price,
((bnb_price-last_price)/bnb_price)*100 as bnb_price_change
from ethereum.core.fact_hourly_token_prices where token_address=lower('0x418D75f65a02b3D53B2418FB8E1fe493759c7605') and hour>=CURRENT_DATE-365
group by 1
),
matic_price as (
select
trunc(hour,'day') as date,
avg(price) as matic_price,
LAG(matic_price,1) IGNORE NULLS OVER (ORDER BY date) as last_price,
((matic_price-last_price)/matic_price)*100 as matic_price_change
from ethereum.core.fact_hourly_token_prices where token_address=lower('0x7c9f4C87d911613Fe9ca58b579f737911AAD2D43') and hour>=CURRENT_DATE-365
group by 1
Run a query to Download Data