Nige7777Copy of Terra 28 stablecoin volitlaty
    Updated 2021-07-28


    WITH cte_T as (
    select distinct
    --date_trunc(hour, block_timestamp) as Time,
    'TERRA' as CHAIN,
    cast(avg(price_usd)as string) as AVG_UST_TERRA,
    MIN(price_usd) as MIN_UST_TERRA,
    MAX(price_usd) as MAX_UST_TERRA

    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,
    'ETHEREUM' as CHAIN,
    cast(avg(ps.price_1_0) as string) as AVG_UST,
    Min(ps.price_1_0) as MIN_UST,
    avg(ps.price_1_0) as MAX_UST
    from uniswapv3.pool_stats ps
    where 1=1
    and ps.block_timestamp >= CURRENT_date - 120
    and pool_address = '0x868b7bbbfe148516e5397f23982923686182c2d2'
    )
    select * from cte_e e
    union all
    select
    * from cte_t t

    Run a query to Download Data