AndyCoolThe fundamentals
Updated 2021-12-08
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
›
⌄
with
luna as (
SELECT
date_trunc('day', block_timestamp) AS date,
avg(price_usd) as luna_price,
max(price_usd) maxluna,
min(price_usd) minluna,
STDDEV(price_usd) as stv_price,
stv_price/luna_price as luna_pct
FROM terra.oracle_prices
where SYMBOL = 'LUNA'
and block_timestamp > CURRENT_DATE - 90
group by date
order by date ASC
),
ust as(
select
date_trunc('day', date) AS date2,
sum(balance) as ust_volume,
STDDEV(balance) as stv_ust
from terra.daily_balances
where currency = 'uusd' or currency = 'UST'
and date2 >CURRENT_DATE - 90
group by date2
order by date2 asc
)
SELECT
date,
luna_price,
ust_volume
from luna, ust
where date = date2
Run a query to Download Data