Updated 4 days ago
    WITH base AS (
    SELECT
    tx_id,
    block_id,
    swap_from_mint,
    swap_to_mint,
    swap_from_amount,
    swap_to_amount,
    swap_from_amount_usd,
    swap_to_amount_usd
    FROM solana.defi.ez_dex_swaps
    WHERE block_timestamp >= DATE_TRUNC('day', DATEADD(day, -8, CURRENT_TIMESTAMP()))
    ),

    flattened AS (
    SELECT
    tx_id,
    block_id,
    swap_from_mint AS address,
    COALESCE(swap_from_amount_usd, swap_to_amount_usd) / NULLIF(swap_from_amount, 0) AS price
    FROM base
    UNION ALL
    SELECT
    tx_id,
    block_id,
    swap_to_mint AS address,
    COALESCE(swap_to_amount_usd, swap_from_amount_usd) / NULLIF(swap_to_amount, 0) AS price
    FROM base
    ),

    prices AS (
    SELECT
    address,
    tx_id,
    block_id,
    MAX(price) AS price
    Last run: 4 days ago
    DAY
    TRADERS
    VOLUME
    SWAPS
    1
    2025-04-16 00:00:00.0003175111198684909.275624170113
    2
    2025-04-12 00:00:00.0002662461091238284.047284160894
    3
    2025-04-13 00:00:00.0002580461028563059.29733885753
    4
    2025-04-10 00:00:00.0002380401058816183.683023808239
    5
    2025-04-18 00:00:00.000215636522350993.4787232579849
    6
    2025-04-11 00:00:00.0002894631121449768.279264054675
    7
    2025-04-15 00:00:00.0002676851059818680.383173989261
    8
    2025-04-17 00:00:00.0002852171016202567.224663871159
    9
    2025-04-14 00:00:00.0002536331107206318.72694093561
    9
    539B
    124s