SniperWeekly Number of Traders
    Updated 2024-06-06
    -- forked from pentalimited / Vertex perpetual and spot trades @ https://flipsidecrypto.xyz/pentalimited/q/42ijY6O4aPaB/vertex-perpetual-and-spot-trades
    -- Credit for pentalimited
    SELECT
    date_trunc('week',block_timestamp) as time
    ,
    'PERP' as type
    ,
    sum(case when is_taker= 'true' then amount_usd end) as amount_vol
    ,
    sum(amount_vol) over (order by time) as total_amount
    ,
    count(distinct trader) as users
    ,
    count(distinct digest) as orders
    ,
    sum(orders) over (order by time) as total_orders
    ,
    count(distinct EZ_PERP_TRADES_ID) as trades
    ,
    sum(trades) over (order by time) as total_trades

    from arbitrum.vertex.ez_perp_trades
    group by 1

    UNION

    SELECT
    date_trunc('week',block_timestamp) as time
    ,
    'SPOT' as type
    ,
    sum(case when is_taker= 'true' then amount_usd end) as amount_vol
    ,
    sum(amount_vol) over (order by time) as total_amount
    ,
    count(distinct trader) as users
    QueryRunArchived: QueryRun has been archived