SniperWeekly Swaps and Swappers Count
    Updated 2024-11-02
    select
    trunc(BLOCK_TIMESTAMP::date,'week') as date,
    -- case when TOKEN_in = '0x72e4f9f808c49a2a61de9c5896298920dc4eeea9' then 'SELL'
    -- when TOKEN_out = '0x72e4f9f808c49a2a61de9c5896298920dc4eeea9' then 'BUY' end as type,
    count(DISTINCT ORIGIN_FROM_ADDRESS) as swappers,
    count(DISTINCT TX_HASH) as swaps,
    sum(AMOUNT_IN_USD) as "Volume",
    avg(AMOUNT_IN_USD) as avg_volume_usd,
    sum(swappers) over (order by date asc) as cumulative_swappers,
    avg("Volume") over (order by date rows between 1 preceding and 0 following) as "Moving Average 7D",
    avg("Volume") over (order by date rows between 2 preceding and 0 following) as "Moving Average 14D",
    avg("Volume") over (order by date rows between 4 preceding and 0 following) as "Moving Average 30D"
    from ethereum.defi.ez_dex_swaps
    where AMOUNT_IN_USD is NOT NULL
    and TOKEN_in = '0x72e4f9f808c49a2a61de9c5896298920dc4eeea9' OR
    TOKEN_out = '0x72e4f9f808c49a2a61de9c5896298920dc4eeea9'
    group by 1
    order by 1 desc



    QueryRunArchived: QueryRun has been archived