winnie-fs2023-05-30 01:26 PM
    Updated 2023-05-30
    WITH

    first_txs AS (
    SELECT
    mint AS token_address,
    MIN(first_tx) AS first_tx
    FROM
    (
    (
    SELECT
    swap_from_mint AS mint,
    MIN(block_timestamp) as first_tx
    FROM
    solana.core.fact_swaps
    GROUP BY
    1
    )
    UNION ALL
    (
    SELECT
    swap_to_mint AS mint,
    MIN(block_timestamp) as first_tx
    FROM
    solana.core.fact_swaps
    GROUP BY
    1
    )
    )
    WHERE
    first_tx >= DATE '2022-01-01'
    AND first_tx <= DATE '2022-12-31'
    GROUP BY 1
    ),

    fs_prices AS (
    SELECT
    Run a query to Download Data