nsa2000 Swap Volume (in OSMO) by Hourly on Oct 28th VS. MA 60-day
    Updated 2022-11-03
    with ma as (
    select
    date_trunc('day', block_timestamp) as date,
    count(DISTINCT tx_id) as swap_cnt,
    sum(to_amount/1e6) as vol_oasmo
    from osmosis.core.fact_swaps
    WHERE date >= '2022-01-01'
    and to_currency = 'uosmo'
    group by 1
    )
    , ma_60day as (
    SELECT
    date,
    avg(swap_cnt) over (ORDER BY date ROWS BETWEEN 60 PRECEDING AND CURRENT ROW) as ma_60_osmo_tx_swapped,
    avg(vol_oasmo) over (ORDER BY date ROWS BETWEEN 60 PRECEDING AND CURRENT ROW) as ma_60_osmo_amount_swapped
    FROM ma
    )
    , tx_Oct28 as (
    select
    date_trunc('hour', BLOCK_TIMESTAMP) as date,
    count(DISTINCT tx_id) as Oct28_swap_cnt,
    sum(to_amount/1e6) as Oct28_vol_oasmo
    from osmosis.core.fact_swaps
    where block_timestamp::date = '2022-10-28'
    and to_currency = 'uosmo'
    group by 1
    )
    SELECT
    *,
    (select ma_60_osmo_tx_swapped from ma_60day where date::date = '2022-10-28') as ma_60day_osmo_tx_swap,
    (select ma_60_osmo_amount_swapped from ma_60day where date::date = '2022-10-28') as ma_60day_osmo_vol_swap
    FROM tx_Oct28
    Run a query to Download Data