Updated 2025-03-31
    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 >= DATEADD(day, -7, 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: 22 days ago
    TOKEN_PAIR
    SWAPS
    VOLUME
    PERCENT_OF_TOTAL_VOLUME
    1
    USDC-SOL58625891191478354.7095520.084380877
    2
    SOL-SOL2641553779570699.75956513.140981364
    3
    USDC-USDC764238396607854.2359936.685495521
    4
    USDC-USDT144745317154655.0302285.346177598
    5
    FARTCOIN-USDC63234300646978.7940245.067912823
    6
    JITOSOL-SOL18523101628007.6990181.713111788
    7
    JLP-USDC2550191355058.27606381.539943867
    8
    GHIBLI-SOL21098091064289.11848911.535042462
    9
    USDC-JUP8391290700598.01823821.528911834
    10
    TRUMP-USDC4144681287827.36818591.37024368
    11
    USDT-SOL177303268411381.47504431.153189428
    12
    USDG-USDC214454913745.00406630.9256639583
    13
    DSOL-SOL102354290378.6040.9151560644
    14
    FARTCOIN-SOL4298647694571.01301170.8039725827
    15
    GHIBLI-USDC5670933938975.85470670.5720987838
    16
    JELLYJELLY-SOL4037228101041.95518150.4736905437
    17
    USDC-EURC153928002328.9522520.4720265693
    18
    SOL-JUPSOL361325100100.70874770.4231046084
    19
    RFC-SOL9013724831694.45196530.4185801674
    20
    WBTC-USDC1903124673968.3126210.4159214268
    ...
    1000
    49KB
    128s