TheLaughingManall time volume - spot
    Updated 2025-02-14
    -- forked from all time volume - perps ( No EDGE ) @ https://flipsidecrypto.xyz/studio/queries/9a60061d-35fc-4256-91ac-3c24833fb613

    with merge as (

    ---arbitrum
    SELECT * EXCLUDE version, 'arbitrum' as label from arbitrum.vertex.ez_spot_trades
    WHERE 1=1
    -- UNION ALL
    -- ---base
    -- SELECT *, 'base' as label from base.vertex.ez_spot_trades
    -- WHERE 1=1

    -- UNION ALL
    -- ---blitz
    -- SELECT * , 'blitz' as label from blast.blitz.ez_spot_trades
    -- WHERE 1=1

    UNION ALL
    ---mantle
    SELECT *, 'mantle' as label from mantle.vertex.ez_spot_trades
    WHERE 1=1

    -- UNION ALL
    -- ---sei ERROR SQL compilation error: Object 'SEI.VERTEX.EZ_SPOT_TRADES' does not exist or not authorized.

    -- SELECT * , 'sei' as label from sei.vertex.ez_spot_trades
    -- WHERE 1=1

    )

    SELECT
    COALESCE(COUNT(DISTINCT trader), 0) AS unique_traders
    , COALESCE(COUNT(DISTINCT digest), 0) AS total_orders
    , COALESCE(SUM(CASE WHEN (is_taker=FALSE) THEN amount_usd ELSE 0 END), 0) AS total_volume
    , COALESCE(SUM(fee_amount), 0) as total_fees
    QueryRunArchived: QueryRun has been archived