elenahooLUNA daily price & LUNA/bLUNA premium
    Updated 2022-01-01
    with bluna_price as (
    select date_trunc('day',block_timestamp) as date
    , source as bluna_source
    , avg(price_usd) as bluna_usd
    from terra.oracle_prices
    where lower(SYMBOL) in ('bluna')
    and date_trunc('day',block_timestamp) > '2021-10-31 00:00:00.000'
    group by 1,2
    ),
    luna_price as (
    select date_trunc('day',block_timestamp) as date
    , source as luna_source
    , avg(price_usd) as luna_usd
    from terra.oracle_prices
    where lower(SYMBOL) in ('luna')
    and date_trunc('day',block_timestamp) > '2021-10-31 00:00:00.000'
    group by 1,2
    )
    select a.date
    , luna_source
    , luna_usd
    , bluna_source
    , bluna_usd
    , (luna_usd - bluna_usd) as luna_bluna_premium
    , (luna_usd - bluna_usd)/luna_usd as premium_pct
    from bluna_price as a
    join luna_price as b
    on a.date = b.date
    order by date asc

    Run a query to Download Data