messariperps
    Updated 2024-11-14
    with arb as (
    SELECT
    DATE_TRUNC('day', block_timestamp) AS date,
    'abritrum' as chain,
    sum(fee_amount) as perp_fees_usd,
    SUM(amount_usd) AS perp_volume_usd,
    count(distinct trader) as perp_traders,
    count(*) as perp_trades
    FROM arbitrum.vertex.ez_perp_trades
    WHERE date(block_timestamp) >= date('2023-03-09')
    AND is_taker = 'TRUE'
    GROUP BY 1, 2
    ),

    bse as (
    SELECT
    DATE_TRUNC('day', block_timestamp) AS date,
    'base' as chain,
    sum(fee_amount) as perp_fees_usd,
    SUM(amount_usd) AS perp_volume_usd,
    count(distinct trader) as perp_traders,
    count(*) as perp_trades
    FROM base.vertex.ez_perp_trades
    WHERE date(block_timestamp) >= date('2024-09-06')
    AND is_taker = 'TRUE'
    GROUP BY 1, 2
    )

    select * from arb union all select * from bse order by 1 desc, 2 asc;
    QueryRunArchived: QueryRun has been archived