mattkstewTF Arbitrum 2
    Updated 2023-01-19
    with tab1 as (
    select
    date_trunc('day', hour) as date,
    avg(price) as WETH_Price
    from optimism.core.fact_hourly_token_prices
    where symbol like 'WETH'
    group by 1
    )

    , tab2 as (
    select
    date_trunc('day', block_timestamp) as date,
    sum(ETH_Value * WETH_Price) as volume,
    avg(Eth_value * WETH_Price) as Average_size,
    count(*) as transactions,
    count(distinct from_address) as Unique_users

    from arbitrum.core.fact_transactions left outer join tab1
    on date_trunc('day', block_timestamp) = tab1.date
    where block_timestamp > '2022-12-01'
    group by 1 )


    select
    sum(volume),
    avg(average_size),
    sum(transactions)
    from tab2
    Run a query to Download Data