Nige7777Terra 28 stablecoin volatility zoom
    Updated 2021-07-27



    WITH cte_T as (
    select distinct
    date_trunc(MINUTE, block_timestamp) as Time,
    date_trunc(day, block_timestamp) as Day,
    avg(price_usd) over (partition by date_trunc(MINUTE, block_timestamp) order by date_trunc(MINUTE, block_timestamp) ) as UST_PRICE_TERRA,
    count(*) OVER (PArtition by date_trunc(day, block_timestamp) order by date_trunc(day, block_timestamp) ) as t_Count_Price_recordings
    --'TERRA' as
    from terra.oracle_prices op
    where 1=1
    and op.block_timestamp >= '2021-07-04T00:00:00Z' and op.block_timestamp < '2021-07-06T00:00:00Z'
    and op.symbol = 'UST'


    ),
    cte_e as (
    select distinct
    date_trunc(MINUTE, block_timestamp) as Time,
    date_trunc(day, block_timestamp) as Day,
    avg(ps.price_1_0) over (partition by date_trunc(MINUTE, block_timestamp) order by block_id ) as UST_PRICE_ETH,
    count(*) OVER (PArtition by date_trunc(day, block_timestamp) order by date_trunc(day, block_timestamp) ) as e_Count_Price_recordings,
    'ETHEREUM' as CHAIN
    from uniswapv3.pool_stats ps
    where 1=1
    and ps.block_timestamp >= '2021-07-04T00:00:00Z' and ps.block_timestamp < '2021-07-06T00:00:00Z'
    and pool_address = '0x868b7bbbfe148516e5397f23982923686182c2d2'
    )
    select * from cte_e e
    inner join cte_t t on t.time = e.time


    Run a query to Download Data