Nige777746 Bonded vs unbonded luna price
    Updated 2021-08-18
    with cte_l as (
    select
    DISTINCT
    date_trunc('DAY',block_timestamp) AS DAY,
    AVG (Price_USD ) OVER (partition by date_trunc('DAY',block_timestamp) ORDER by date_trunc('DAY',block_timestamp) ) AS Luna_PRICE
    from terra.oracle_prices p
    where
    block_timestamp >= CURRENT_DATE -180
    and currency = 'uluna'
    ),
    cte_b as (
    select
    DISTINCT
    date_trunc('DAY',block_timestamp) AS DAY,
    AVG (Price_USD ) OVER (partition by date_trunc('DAY',block_timestamp) ORDER by date_trunc('DAY',block_timestamp) ) AS UST_PRICE
    from terra.oracle_prices p
    where
    block_timestamp >= CURRENT_DATE -180
    and symbol = 'UST'
    )
    select l.day , luna_price, ust_price
    from cte_l l
    inner join cte_b b on b.day = l.day
    Run a query to Download Data