nsa2000Luna price states
Updated 2022-10-07
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 luna_price as (
select
date_trunc('week',block_timestamp) as date,
avg(price_usd) as avg_price,
min(price_usd) as min_price,
max(price_usd) as max_price
from terra.oracle_prices
where symbol = 'LUNA'
and block_timestamp >= '2022-05-15' -- Inception date
group by date
),
open_strike_price as (
select * from (
select
date_trunc('week',block_timestamp) as date,
price_usd as open_price,
1.15 * price_usd as strike_price,
rank() over (partition by date order by block_timestamp asc) as rank
from terra.oracle_prices
where symbol = 'LUNA'
and block_timestamp >= '2022-05-15' -- Inception date
) where rank = 1
),
close_price as (
select * from (
select
date_trunc('week',block_timestamp) as date,
price_usd as close_price,
rank() over (partition by date order by block_timestamp desc) as rank
from terra.oracle_prices
where symbol = 'LUNA'
and block_timestamp >= '2022-05-15' -- Inception date
) where rank = 1
)
select
Run a query to Download Data