Afonso_Diazcategorizing swappers
    Updated 2025-03-22
    with

    main as (
    select
    tx_hash,
    block_timestamp,
    origin_from_address as swapper,
    nvl(amount_in_usd, amount_out_usd) as amount_usd,
    iff(token_in = '0xc891eb4cbdeff6e073e859e987815ed1505c2acd', amount_in, amount_out) as amount_euro
    from
    avalanche.defi.ez_dex_swaps
    where
    '0xc891eb4cbdeff6e073e859e987815ed1505c2acd' in (token_in, token_out)
    ),

    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 'Few (2-3 Swaps)'
    when swaps <= 7 then 'Moderate (4-7 Swaps)'
    when swaps <= 15 then 'Active (8-15 Swaps)'
    when swaps <= 30 then 'Frequent (16-30 Swaps)'
    else 'Power Swapper (More than 30 Swaps)'
    end as type,
    count(distinct swapper) as swappers
    from
    swappers
    QueryRunArchived: QueryRun has been archived