Pine Analyticsslow-coral copy copy copy
    Updated 2025-03-08
    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'
    when swap_volume_usd < 10000000 then 'g/ 1M-10M'
    else 'h/ 10M+' end as swap_volume_group,
    count(*) as swappers,
    sum(swap_volume_Usd) as total_swap_volume

    from (
    select
    from_address,
    count(Distinct tx_id) as transactions,
    sum(case when not FROM_AMOUNT_USD is null then FROM_AMOUNT_USD else to_AMOUNT_USD end) as swap_volume_Usd


    from maya.defi.fact_swaps
    where block_timestamp > current_date - 30
    group by 1
    order by 3 desc
    )
    group by 1



    QueryRunArchived: QueryRun has been archived