0xaimanluna price vs native ust peg
    Updated 2022-05-10


    with a as (
    with native as (select date_trunc('hour', block_timestamp) as hour1, avg(price_usd) as price1
    from terra.oracle_prices
    where symbol='UST' and block_timestamp>='2022-05-03'

    group by 1 order by 1),


    wholee as ( select hour as hour2, price as price2
    from ethereum_core.fact_hourly_token_prices
    -- where symbol='UST' and
    where token_address='0xa693b19d2931d498c5b318df961919bb4aee87a5' and
    hour>='2022-05-03'

    )

    select hour1, price1 as peg_on_Terra, price2 as peg_on_Ethereum
    from native
    inner join wholee on native.hour1=wholee.hour2
    ),



    b as (select date_trunc('hour', block_timestamp) as hour2, avg(price_usd) as price2

    from terra.oracle_prices
    where symbol='LUNA' and block_timestamp>='2022-05-03'
    group by 1)

    select hour1, peg_on_Terra ,peg_on_Ethereum, price2 as luna_price
    from a
    inner join b on a.hour1=b.hour2

    Run a query to Download Data