Nige7777Terra 28 stablecoin volatility
    Updated 2021-07-28
    -- select msg_module, count(*)
    -- FROM
    -- terra.msgs
    -- --,Table(Flatten(terra.msgs.msg_value:exchange_rates)) F
    -- WHERE 1=1
    -- --and terra.msgs.msg_value:exchange_rates is not null
    -- --and msg_type like '%oracle%' --oracle/MsgAggregateExchangeRateVote'
    -- -- and msg_module = 'oracle'
    -- AND tx_status = 'SUCCEEDED'
    -- AND block_timestamp >= CURRENT_DATE - 1
    -- group by msg_module
    -- limit 1000


    WITH cte_T as (
    select distinct
    date_trunc(hour, block_timestamp) as Time,
    avg(price_usd) over (partition by date_trunc(hour, block_timestamp) order by date_trunc(hour, block_timestamp) ) as UST_TERRA
    --'TERRA' as
    from terra.oracle_prices op
    where 1=1
    and op.block_timestamp >= CURRENT_date -120
    and op.symbol = 'UST'


    ),
    cte_e as (
    select distinct
    date_trunc(hour, block_timestamp) as Time,
    avg(ps.price_1_0) over (partition by date_trunc(hour, block_timestamp) order by block_id ) as UST_ETH,
    'ETHEREUM' as CHAIN
    from uniswapv3.pool_stats ps
    where 1=1
    and ps.block_timestamp >= CURRENT_date - 120
    Run a query to Download Data