Moe--
    Updated 2023-05-24
    select
    type ,
    count (distinct tx_id) as num_swaps,
    count (distinct trader) as num_swappers,
    sum (USD_Volume) as USD_Vol,
    avg (USD_Volume) as avg_USD_Vol




    from
    ( select * from
    ((with scr_prices as (select
    date(recorded_at) as days,
    avg(price) as price,
    sum(VOLUME_24H) as vol
    from
    osmosis.core.dim_prices
    where
    symbol ilike ('arb' )
    group by 1
    )

    select
    BLOCK_TIMESTAMP::date as date,
    rank()over(order by date asc) as days_count ,
    tx_id ,trader,((from_amount/1e18)*price) as USD_Volume,
    'Arb out' as type
    from osmosis.core.fact_swaps sw
    inner join scr_prices pr on sw.block_timestamp::date = pr.days
    where
    from_currency = 'ibc/10E5E5B06D78FFBB61FD9F89209DEE5FD4446ED0550CBB8E3747DA79E10D9DC6'
    )

    union all ------------********************************--------------------------*********************-----------

    Run a query to Download Data