StangFAST010 - 01 - 1
    Updated 2023-12-09

    with

    price AS
    (
    SELECT
    date_trunc( 'day' , a.recorded_hour ) AS date
    , avg( a.close ) AS price
    , a.token_address AS token
    , a.symbol AS symbol
    FROM
    solana.price.ez_token_prices_hourly a
    WHERE
    a.token_address = '5MAYDfq5yxtudAhtfyuMBuHZjgAbaS9tbEyEQYAhDS5y'
    GROUP BY 1 , 3 , 4
    ORDER BY 1 DESC
    )
    SELECT
    a.block_timestamp AS dt
    , a.tx_id AS tx
    , a.signers[0] AS sg
    , trim( split( b.value, ':' ) [2] ) AS ac
    , ( c.am / power( 10 , 6 ) ) * d.price AS am
    , c.sg AS ow
    FROM
    solana.core.fact_transactions a
    JOIN
    lateral flatten (input => a.log_messages) b
    JOIN (
    SELECT
    block_timestamp
    , tx_id
    , signers[1] AS sg
    , inner_instruction:"instructions"[0]:"parsed":"info":"mint" AS mn
    , inner_instruction:"instructions"[0]:"parsed":"info":"amount" AS am
    FROM