amirrzTop 10 SCRT swappers by swap volume
    Updated 2022-10-12
    with prices as (
    select recorded_at::date as day,
    avg (price) as price
    from osmosis.core.dim_prices
    where symbol = 'SCRT'
    and recorded_at >= CURRENT_DATE - 7
    group by 1),

    swap as (
    select
    'from SCRT' as type,
    trader,
    count (distinct tx_id) as swaps,
    sum(from_amount/1e6) as Volume,
    sum((from_amount/1e6)*Price) as USD_Volume
    from osmosis.core.fact_swaps a join prices b on a.block_timestamp::date = b.day
    where from_currency = 'ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A'
    and block_timestamp::date >= CURRENT_DATE - 7
    and block_timestamp::date < current_date
    and tx_status = 'SUCCEEDED'
    group by 1,2

    union ALL

    select
    'to SCRT' as type,
    trader,
    count (distinct tx_id) as swaps,
    sum(from_amount/1e6) as Volume,
    sum((from_amount/1e6)*Price) as USD_Volume
    from osmosis.core.fact_swaps a join prices b on a.block_timestamp::date = b.day
    where to_currency = 'ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A'
    and block_timestamp::date >= CURRENT_DATE - 7
    and block_timestamp::date < current_date
    and tx_status = 'SUCCEEDED'
    group by 1,2)
    Run a query to Download Data