Updated 2024-12-04
    WITH
    total
    AS
    (
    SELECT
    value:Account:: string AS address,
    value:Quantity:: int AS total_amount
    FROM
    (
    SELECT
    live.udf_api('https://raw.githubusercontent.com/Raymond1944/Optimism-5/refs/heads/main/Stocks%2022.json') as rawoutput
    ), LATERAL FLATTEN ( input => rawoutput:data)
    )
    ,
    total_total
    AS
    (
    SELECT
    MAX(block_timestamp) AS last_transaction,
    swapper,
    total_amount
    FROM
    solana.defi.ez_dex_swaps
    JOIN
    total
    ON
    address = swapper
    WHERE
    swapper IN (SELECT address FROM total)
    GROUP
    BY
    swapper, total_amount
    HAVING
    last_transaction > CAST('2024-09-01' AS TIMESTAMP)
    ORDER
    BY