i_danAvax VS Base: Monthly Metrics
    Updated 2024-11-27
    WITH trades AS (
    SELECT
    block_timestamp
    , 'Base' AS blockchain
    , tx_hash
    , CASE WHEN amount_in_usd IS NOT NULL AND amount_out_usd IS NOT NULL THEN ((amount_in_usd+amount_out_usd)/2)
    WHEN amount_in_usd IS NULL AND amount_out_usd IS NULL THEN NULL
    WHEN amount_in_usd IS NULL AND amount_out_usd IS NOT NULL THEN amount_out_usd
    WHEN amount_in_usd IS NOT NULL AND amount_out_usd IS NULL THEN amount_in_usd
    ELSE NULL END AS amount
    , origin_from_address
    FROM base.defi.ez_dex_swaps
    WHERE YEAR(block_timestamp) = 2024
    AND (amount_in_usd IS NOT NULL OR amount_out_usd IS NOT NULL)

    UNION ALL

    SELECT
    block_timestamp
    , 'Avalanche' AS blockchain
    , tx_hash
    , CASE WHEN amount_in_usd IS NOT NULL AND amount_out_usd IS NOT NULL THEN ((amount_in_usd+amount_out_usd)/2)
    WHEN amount_in_usd IS NULL AND amount_out_usd IS NULL THEN NULL
    WHEN amount_in_usd IS NULL AND amount_out_usd IS NOT NULL THEN amount_out_usd
    WHEN amount_in_usd IS NOT NULL AND amount_out_usd IS NULL THEN amount_in_usd
    ELSE NULL END AS amount
    , origin_from_address
    FROM avalanche.defi.ez_dex_swaps
    WHERE YEAR(block_timestamp) = 2024
    AND (amount_in_usd IS NOT NULL OR amount_out_usd IS NOT NULL)
    )

    SELECT
    date_trunc('month', block_timestamp) AS "Month"
    QueryRunArchived: QueryRun has been archived