StangFAST04 - inout
    Updated 2023-05-20
    -- forked from 04 - inout @ https://flipsidecrypto.xyz/edit/queries/3da63dd4-b507-40c2-a269-5f7c555d3ed4

    -- forked from 02 - inout @ https://flipsidecrypto.xyz/edit/queries/9ec91613-6266-4361-86eb-75a688e1f76e

    -- forked from 02 - activity @ https://flipsidecrypto.xyz/edit/queries/a76e08de-ed30-4746-a309-3aac942009a8

    -- forked from 01 - CEX to cex @ https://flipsidecrypto.xyz/edit/queries/fdc02176-5bc7-496e-9316-ad5821921bd4

    --- outflow use origin_to_address
    --- inflow user origin_from_address

    with
    eth_price AS
    (
    SELECT
    date_trunc( 'day' , a.hour ) AS day
    , avg( a.price ) AS price_usd
    FROM
    ethereum.core.fact_hourly_token_prices a
    WHERE
    a.symbol = 'WETH'
    GROUP BY
    1
    ORDER BY
    1
    )

    ,

    --- Outflow ---
    from_cex AS
    (
    SELECT
    count( DISTINCT a.tx_hash ) AS transactions
    , count( DISTINCT a.origin_from_address ) AS users
    , sum( a.amount_usd ) AS usd_volumes
    Run a query to Download Data