Pine AnalyticsBlub metrics copy copy copy
    Updated 2025-03-07
    select
    case when swap_volume_usd < 10 then 'a/ below 10'
    when swap_volume_usd < 100 then 'b/ 10-100'
    when swap_volume_usd < 1000 then 'c/ 100-1K'
    when swap_volume_usd < 10000 then 'd/ 1K-10K'
    when swap_volume_usd < 100000 then 'e/ 10K-100K'
    when swap_volume_usd < 1000000 then 'f/ 100K-1M'
    else 'g/ 1M+' end as swap_volume_group,
    count(*) as wallets,
    sum(swap_volume_usd) as total_swap_volume

    from (
    select
    ORIGIN_FROM_ADDRESS,
    count(distinct tx_hash) as swaps,
    sum(
    case when not AMOUNT_IN_USD is null then AMOUNT_IN_USD
    when not AMOUNT_out_USD is null then AMOUNT_out_USD end
    ) as swap_volume_usd

    from avalanche.defi.ez_dex_swaps
    where token_in like lower('0x0f669808d88B2b0b3D23214DCD2a1cc6A8B1B5cd')
    or token_out like lower('0x0f669808d88B2b0b3D23214DCD2a1cc6A8B1B5cd')
    group by 1
    having not swap_volume_usd is null
    order by 3 desc
    )
    group by 1

    QueryRunArchived: QueryRun has been archived