MoeCopy of osmfp-swp from2
    Updated 2022-10-12
    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 in ('SCRT' )
    and days >= CURRENT_DATE - 7
    group by 1
    order by 1)


    select
    LABEL as destination_token,
    count (distinct tx_id) as num_swaps,
    count (distinct trader) as num_swappers,
    sum (from_amount/1e6) as native_volume,
    sum ((from_amount/1e6)*price) as USD_Volume
    from osmosis.core.fact_swaps sw
    inner join scr_prices pr on sw.block_timestamp::date = pr.days
    inner join osmosis.core.dim_labels l on sw.to_currency =l.address
    where
    from_currency = 'ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A'
    and
    block_timestamp >= CURRENT_DATE - 7
    and
    tx_status = 'SUCCEEDED'
    group by 1 order by 4 desc limit 10


    Run a query to Download Data