mz0111osmosis 907 6
    Updated 2023-02-17
    with tab1 as (
    select
    distinct trader as Swappers,
    'Swap From MARS' as swap_type,
    count (*) as Swaps_num
    from osmosis.core.fact_swaps
    where from_currency = 'ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580'
    and block_timestamp >= CURRENT_DATE - 20
    and TX_SUCCEEDED = 'TRUE'
    group by 1 , 2


    union ALL

    select
    distinct trader as Swappers,
    'Swap TO MARS' as swap_type,
    count (*) as Swaps_num
    from osmosis.core.fact_swaps
    where to_currency = 'ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580'
    and block_timestamp >= CURRENT_DATE - 20
    and TX_SUCCEEDED = 'TRUE'
    group by 1 , 2
    )
    select
    swap_type,
    case when Swaps_num = 1 then 'only 1 swap'
    when Swaps_num > 1 and Swaps_num <= 10 then '1-10 swaps'
    when Swaps_num >10 and Swaps_num <= 100 then '10-100 swaps'
    when Swaps_num > 100 and Swaps_num <= 1000 then '100-1000 swaps'
    when Swaps_num > 1000 and Swaps_num <= 10000 then '1000-10000 swaps'
    when Swaps_num > 10000 then 'more than 10000 swaps'
    end as type,
    count( Swappers) as " Swappers count"
    Run a query to Download Data