LTirrell2022-02-25_terra_52-pickup
Updated 2022-03-01
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 price as (
select
date_trunc('day', block_timestamp) as datetime,
avg(price_usd) as daily_avg_price,
min(price_usd) as daily_min_price,
max(price_usd) as daily_max_price
from
terra.oracle_prices
where
symbol = 'LUNA'
and datetime >= '2021-09-30'
group by
datetime
order by
datetime asc
),
above_value as (
select
datetime,
case
when daily_avg_price >= 52 then 1
else 0
end as avg_above,
case
when daily_min_price >= 52 then 1
else 0
end as min_above,
case
when daily_max_price >= 52 then 1
else 0
end as max_above
from
price
)
select
price.datetime,
Run a query to Download Data