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,
    Last run: 18 days ago
    TYPE
    SWAPPERS
    1
    16 - 30 Swaps8781
    2
    2 - 3 Swaps123609
    3
    31 - 50 Swaps3812
    4
    4 - 7 Swaps33764
    5
    8 - 15 Swaps19808
    6
    High-Volume Swapper (50+ Swaps)9498
    7
    Single Swap403842
    7
    179B
    443s