Abolfazl_771025user categorize by volume (USD) of swap (Ape token)
    Updated 2022-10-25
    with main as (select
    DISTINCT ORIGIN_FROM_ADDRESS as users,
    count(distinct tx_hash) as "count of swap",
    sum(AMOUNT_out_USD) as "volume (USD) of swap"
    from ethereum.core.ez_dex_swaps
    where TOKEN_out = lower('0x4d224452801ACEd8B2F0aebE155379bb5D594381')
    and AMOUNT_out_USD is not null
    group by 1
    union
    select
    DISTINCT ORIGIN_to_ADDRESS as users,
    count(distinct tx_hash) as "count of swap",
    sum(AMOUNT_in_USD) as "volume (USD) of swap"
    from ethereum.core.ez_dex_swaps
    where TOKEN_in = lower('0x4d224452801ACEd8B2F0aebE155379bb5D594381')
    and AMOUNT_in_USD is not null
    group by 1)
    select
    case
    when "volume (USD) of swap" < 100 then 'Swap less than 100 USD'
    when "volume (USD) of swap" between 100 and 499.99 then 'Swap 100 - 500 USD'
    when "volume (USD) of swap" between 500 and 999.99 then 'Swap 500 - 1 K USD'
    when "volume (USD) of swap" between 10000 and 2499.99 then 'Swap 1 K - 2.5 K USD'
    when "volume (USD) of swap" between 2500 and 4999.99 then 'Swap 2.5 K - 5 K USD'
    when "volume (USD) of swap" between 5000 and 9999.99 then 'Swap 5 K - 10 K USD'
    when "volume (USD) of swap" between 10000 and 19999.99 then 'Swap 10 K - 20 K USD'
    when "volume (USD) of swap" between 20000 and 49999.99 then 'Swap 20 K - 50 K USD'
    when "volume (USD) of swap" between 50000 and 999999.99 then 'Swap 50 K - 100 K USD'
    else 'Swap more than 100 K USD'
    end as "swap volume",
    count(users) as "count of swappers"
    from main
    group by 1
    Run a query to Download Data