TheLaughingMan[MASTER] Quarterly Comparisons Optimized (+ instance param)
    Updated 2025-04-11
    -- forked from Quarterly Comparisons Optimized (EDGE Excluded) @ https://flipsidecrypto.xyz/studio/queries/0527b0dc-7cba-4b3e-9507-57f43d07bcf8

    -- forked from Quarterly Comparisons Strings+Emojis Optimized (EDGE included) @ https://flipsidecrypto.xyz/studio/queries/ef7b409d-a864-4e78-9961-bc7392a1814f

    with trades_data as (

    SELECT * EXCLUDE version, 'arbitrum' as label from arbitrum.vertex.ez_perp_trades
    WHERE 1=1
    AND (DATEDIFF('month', '{{quarter_start}}', block_timestamp::date) BETWEEN -9 and 2)
    AND (
    ( -- ignore EDGE if all instances being tallied & avoid double counting...
    'all' = lower('{{instance}}')
    AND trader != '0x0000000000000000000000000000000000000000'
    AND subaccount!='0x0000000000000000000000000000000000000000000000000000000000000001'
    )
    OR
    ( -- individual instance, no need to filter EDGE
    label = lower('{{instance}}')
    )
    )
    UNION ALL
    ---base
    SELECT *, 'base' as label from base.vertex.ez_perp_trades
    WHERE 1=1
    AND (DATEDIFF('month', '{{quarter_start}}', block_timestamp::date) BETWEEN -9 and 2)
    AND (
    ( -- ignore EDGE if all instances being tallied & avoid double counting...
    'all' = lower('{{instance}}')
    AND trader != '0x0000000000000000000000000000000000000000'
    AND subaccount!='0x0000000000000000000000000000000000000000000000000000000000000001'
    )
    OR
    ( -- individual instance, no need to filter EDGE
    label = lower('{{instance}}')
    )
    )
    Last run: 19 days ago
    METRIC
    '2024-Q2'
    '2024-Q3'
    '2024-Q4'
    '2025-Q1'
    1
    TOTAL_VOLUME 29,390,359,973.00 21,964,118,033.00 (🔻-25.27%) 17,230,573,808.00 (🔻-21.55%) 12,311,262,393.00 (🔻-28.55%)
    2
    TOTAL_TRADES 20,377,269 22,122,088 (↗️8.56%) 14,977,110 (🔻-32.30%) 9,549,985 (🔻-36.24%)
    3
    TOTAL_TRADERS 20,841 19,142 (🔻-8.15%) 3,758 (🔻-80.37%) 1,625 (🔻-56.76%)
    4
    TOTAL_FEES 4,788,527.00 3,390,549.00 (🔻-29.19%) 2,494,809.00 (🔻-26.42%) 848,842.00 (🔻-65.98%)
    5
    DAILY_AVG_VOLUME 322,970,989.00 238,740,413.00 (🔻-26.08%) 187,288,846.00 (🔻-21.55%) 136,791,804.00 (🔻-26.96%)
    6
    DAILY_AVG_TRADES 223,927.00 240,458.00 (↗️7.38%) 162,796.00 (🔻-32.30%) 106,112.00 (🔻-34.82%)
    7
    DAILY_AVG_TRADERS 1,021 656 (🔻-35.71%) 367 (🔻-44.14%) 199 (🔻-45.65%)
    8
    DAILY_AVG_FEES 52,621.00 36,854.00 (🔻-29.96%) 27,117.00 (🔻-26.42%) 9,432.00 (🔻-65.22%)
    8
    1KB
    22s