0-MIDpepe new and old buyers
    Updated 2023-05-06
    with act1 as (
    with tab1 as (
    select date_trunc('minute',BLOCK_TIMESTAMP) as time
    ,AMOUNT_OUT_USD
    ,ORIGIN_FROM_ADDRESS
    from ethereum.core.ez_dex_swaps
    where TOKEN_OUT='0x6982508145454ce325ddbe47a25d4ec3d2311933')
    select date_trunc('day',time) as day
    ,AMOUNT_OUT_USD
    ,ORIGIN_FROM_ADDRESS
    ,row_number()over(partition by ORIGIN_FROM_ADDRESS order by day) as time_row
    from tab1)
    select day
    ,case
    when time_row=1 then 'New Buyers'else 'Old Buyers' end as buyer_type
    ,count(ORIGIN_FROM_ADDRESS) as buyers
    ,sum(AMOUNT_OUT_USD) as buy_volume
    from act1
    where day>='2023-04-17'
    group by 1,2

    Run a query to Download Data