Updated 2022-10-06
    with t1 as ( select
    trunc(hour,'day') as date,
    symbol ,
    avg(price) as average_price
    from optimism.core.fact_hourly_token_prices
    where symbol in ('WETH','OP') and hour >= CURRENT_DATE - 60
    group by date, symbol
    )
    ,
    price_usd as ( select
    date,
    case when symbol = 'WETH' then 'ETH' else symbol end as token, average_price
    from t1)
    ,
    nft_sales as ( select
    trunc(block_timestamp,'day') as day ,
    tx_hash,
    seller_address,
    nft_address,
    CURRENCY_SYMBOL,
    price,
    buyer_address,
    price*average_price as price_usd
    from optimism.core.ez_nft_sales x left outer join price_usd y on x.block_timestamp::date = y.date
    where CURRENCY_SYMBOL = token)

    select day ,
    sum(price_usd) as sales_volume,
    sum(sales_volume) over (order by day asc) as cumulative_sales_volume

    from nft_sales
    group by day
    Run a query to Download Data