Updated 2023-06-03
    -- forked from 02 @ https://flipsidecrypto.xyz/edit/queries/0ba6a293-212c-42a2-8bc7-5f22b8f0f6e6

    -- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/be6ac40e-9a59-425d-8d99-e592d9287d73

    with

    eth_price AS
    (
    SELECT
    date_trunc( 'day' , a.hour ) AS day
    , avg( a.price ) AS price
    , a.symbol AS currency
    FROM
    ethereum.core.fact_hourly_token_prices a
    GROUP BY
    1 , 3
    ORDER BY
    1 DESC
    )
    ,
    new_eth AS
    (
    SELECT
    min( a.block_timestamp ) AS min_date
    , a.buyer_address AS new_users
    FROM
    ethereum.core.ez_nft_sales a
    JOIN
    eth_price b
    ON date_trunc( 'day' , a.block_timestamp ) = b.day
    AND a.currency_symbol = b.currency
    WHERE
    a.event_type = 'sale'
    GROUP BY
    2
    ORDER BY
    Run a query to Download Data