Updated 2023-08-29
    -- select
    -- *
    -- from solana.core.fact_transfers
    -- where tx_id='5F1VnsqArhRc1hWZmBowmFZvSYqcxKoUmGg6dm1pR1eF591EXCBZucLS4gVGo2QhifxYDpxkNZMojjVEaRf1bJh6'
    -- --where tx_id='5emceBhM3yahT7oSmKp3JoAm3kiGjPsNfhmAmf2dNM2u8DyeFmPw7CcTYoibWoE1bX7kjDsQ2rQugECYdpMdnZgc'
    -- --and EVENT_TYPE='transfer'
    -- and BLOCK_TIMESTAMP>=current_date-30

    -- forked from sp1 @ https://flipsidecrypto.xyz/edit/queries/c57a42bc-4af4-4d9e-af9d-1be9232e7472

    with price_tab as (SELECT
    recorded_hour::date as day,
    avg(close) as token_price
    FROM solana.core.ez_token_prices_hourly
    WHERE token_address = 'So11111111111111111111111111111111111111112'
    and day>=current_date-{{Days_back}}
    group by 1
    ),

    r_tab as (select *
    from solana.core.fact_events
    where succeeded = True
    and program_id = 'stkitrT1Uoy18Dk1fTrgPw8W6MVzoCfYoAFT4MLsmhq'
    and BLOCK_TIMESTAMP>=current_date-{{Days_back}}
    ),

    t_tab as (select
    *
    from solana.core.fact_transfers
    where tx_id in (select tx_id from r_tab)
    and BLOCK_TIMESTAMP>=current_date-{{Days_back}}
    ),

    t_tab1 as (select
    tx_id,
    min(index) as min_index,
    Run a query to Download Data