0-MIDswapper type
    Updated 2025-03-10

    with act1 as (
    select date_trunc('day',BLOCK_TIMESTAMP) as day
    ,count(distinct ORIGIN_FROM_ADDRESS) as total_swappers
    from avalanche.defi.ez_dex_swaps
    where platform in('pharaoh-v1','pharaoh-v2')
    and BLOCK_TIMESTAMP::date>=current_date-30
    group by 1
    ),
    act2 as (
    with tab1 as (
    select ORIGIN_FROM_ADDRESS
    ,min(BLOCK_TIMESTAMP::date) as first_time
    from avalanche.defi.ez_dex_swaps
    where platform in('pharaoh-v1','pharaoh-v2')
    and BLOCK_TIMESTAMP::date>=current_date-30
    group by 1)
    select date_trunc('day',first_time) as day
    ,count(distinct ORIGIN_FROM_ADDRESS) as new_swappers
    from tab1
    group by 1
    )
    select
    act1.day
    ,new_swappers
    ,total_swappers-new_swappers as active_swappers
    ,sum(new_swappers)over(order by act1.day) as total_new_swappers
    from act1
    left join act2
    on act1.day=act2.day




    QueryRunArchived: QueryRun has been archived