HosseinUntitled Query
Updated 2022-11-11Copy Reference Fork
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
›
⌄
select * from (
select
'FTT' as token,
date_trunc('day', hour)::date as day,
iff(day < '2022-11-06', 'Before Crash', 'After Crash') as type,
avg(price) as price_avg,
min(price) as price_min,
max(price) as price_max,
avg (price_avg) over (order by day rows between 6 preceding and current row) as moving_avg_7_days,
avg (price_avg) over (order by day rows between 29 preceding and current row) as moving_avg_30_days
from ethereum.core.fact_hourly_token_prices
where day >= '2022-10-01'
and token_address = '0x50d1c9771902476076ecfc8b2a83ad6b9355a4c9'
group by day, token
union
select
'ETH' as token,
date_trunc('day', hour)::date as day,
iff(day < '2022-11-06', 'Before Crash', 'After Crash') as type,
avg(price) as price_avg,
min(price) as price_min,
max(price) as price_max,
avg (price_avg) over (order by day rows between 6 preceding and current row) as moving_avg_7_days,
avg (price_avg) over (order by day rows between 29 preceding and current row) as moving_avg_30_days
from ethereum.core.fact_hourly_token_prices
where day >= '2022-10-01'
and symbol = 'WETH'
group by day, token
) order by day
Run a query to Download Data