MasiTOTAL DAILY SWAPS LAST 7 DAYS from and to Osmo
    Updated 2022-11-02
    with from_osmo_swap as ( select 'From_Osmo' as status,
    trunc(block_timestamp,'day') as day,
    count(DISTINCT tx_id) as count_tx,
    count(DISTINCT trader) as swappers,
    sum(from_amount/pow(10,6)) as amounts,
    avg(from_amount/pow(10,6)) as avg_amount
    from osmosis.core.fact_swaps
    where from_currency = 'uosmo'
    and TX_STATUS = 'SUCCEEDED'
    group by 1,2)
    ,
    to_osmo_swap as (select 'To_Osmo' as status,
    trunc(block_timestamp,'day') as day,
    count(DISTINCT tx_id) as count_tx,
    count(DISTINCT trader) as swappers,
    sum(to_amount/pow(10,6)) as amounts,
    avg(to_amount/pow(10,6)) as avg_amount
    from osmosis.core.fact_swaps
    where to_currency = 'uosmo'
    and TX_STATUS = 'SUCCEEDED'
    group by 1,2)
    ,
    osmo_price as ( select trunc(RECORDED_AT,'day') as day,
    symbol,
    avg(price) as osmo_price
    from osmosis.core.dim_prices
    where symbol = 'OSMO'
    group by 1,2)
    ,
    tb1 as ( select *
    from from_osmo_swap
    UNION
    select *
    from to_osmo_swap)

    select status,
    Run a query to Download Data