StangFAST02 - activity
    Updated 2023-05-20
    -- forked from 01 - CEX to DEX @ 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
    )

    ,

    --- in_flow ---
    from_cex AS
    (
    SELECT
    date_trunc( 'month' , a.block_timestamp ) AS date
    , count( DISTINCT a.tx_hash ) AS transactions
    , count( DISTINCT a.origin_from_address ) AS users
    , sum( a.amount_usd ) AS usd_volumes
    , sum( b.tx_fee * d.price_usd ) AS fees

    FROM
    ethereum.core.ez_token_transfers a
    JOIN
    Run a query to Download Data