mz0111osmosis 907 8
    Updated 2023-02-17
    with tab1 as
    ((select
    'Swap From MARS' as swap_type,
    trader as Swappers,
    sum (from_amount/pow(10,6)) as Mars_Volume
    from osmosis.core.fact_swaps
    where from_currency = 'ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580'
    and block_timestamp >= CURRENT_DATE - 20
    and TX_SUCCEEDED = 'TRUE'
    group by 1 , 2
    order by 3 DESC
    )

    union


    (select
    'Swap to MARS' as swap_type,
    trader as Swappers,
    sum (to_amount/pow(10,6)) as Mars_Volume
    from osmosis.core.fact_swaps
    where to_currency = 'ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580'
    and block_timestamp >= CURRENT_DATE - 20
    and TX_SUCCEEDED = 'TRUE'
    group by 1 ,2
    order by 3 DESC
    )
    )

    select*
    from tab1
    order by Mars_Volume desc
    limit 10
    Run a query to Download Data