AndyCoolThe fundamentals
    Updated 2021-12-08
    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