MLDZMNpr3
Updated 2023-06-01
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
-- forked from pepe1 @ https://flipsidecrypto.xyz/edit/queries/685ae3df-8f1f-481f-a12c-45d30ae1ef92
-- forked from EDB1 @ https://flipsidecrypto.xyz/edit/queries/431b94f7-1522-40ba-b666-545624e1e884
select
HOUR::date as day,
case when day>='2023-05-24' then 'After upgrade' else 'Before upgrade' end as period,
avg(price) as token_price,
lag(token_price) ignore nulls over(ORDER BY day ASC) as lag_price,
((token_price-lag_price)/token_price)*100 as deviation_price,
avg(token_price) OVER (ORDER BY day ROWS BETWEEN 7 PRECEDING AND CURRENT ROW) as MA_7_Days_volume,
avg(token_price) OVER (ORDER BY day ROWS BETWEEN 15 PRECEDING AND CURRENT ROW) as MA_15_Days_volume
from ethereum.core.fact_hourly_token_prices
where hour>= '2023-05-01'
and TOKEN_ADDRESS in ('0x65ef703f5594d2573eb71aaf55bc0cb548492df4')
group by 1 , 2
Run a query to Download Data