ArioVertex - Weekly Distribution of Traders based on Number of Perp Trades
    Updated 2024-09-27
    with tab1 as (
    select
    date_trunc(week, block_timestamp) as date,
    trader,
    count(DISTINCT tx_hash) over(partition by trader, date) as N_Trades
    from arbitrum.vertex.ez_perp_trades
    )
    SELECT
    date,
    case when N_Trades <= 1 then 'A:1'
    when N_Trades > 1 and N_Trades <= 7 then 'B: 2-7'
    when N_Trades > 7 and N_Trades <= 14 then 'C: 7-14'
    when N_Trades > 14 and N_Trades <= 21 then 'D: 14-21'
    else 'E: > 21'
    end as Status,
    count(DISTINCT trader) as N_trader
    from tab1
    group by 1,2