Afonso_Diazgrouping swappers
    Updated 2025-05-10
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    iff(amount_in_usd > 1e6, amount_out_usd, amount_in_usd) as amount_usd,
    swapper,
    symbol_in,
    symbol_out
    from
    aptos.defi.ez_dex_swaps
    where
    amount_usd < 1e6
    and platform = 'cellana'
    ),

    swappers as (
    select
    swapper,
    count(distinct tx_hash) as swaps
    from
    main
    group by 1
    )

    select
    case
    when swaps = 1 then 'Single Swap'
    when swaps <= 3 then '2 - 3 Swaps'
    when swaps <= 7 then '4 - 7 Swaps'
    when swaps <= 15 then '8 - 15 Swaps'
    when swaps <= 30 then '16 - 30 Swaps'
    when swaps <= 50 then '31 - 50 Swaps'
    else 'High-Volume Swapper (50+ Swaps)'
    end as type,
    QueryRunArchived: QueryRun has been archived