ArioOptimism-USDC Swap Volume
    Updated 2023-04-15
    with Swap as (
    select
    date_trunc(day, BLOCK_TIMESTAMP)::date as date,
    sum(AMOUNT_OUT_USD) as "Swap Volume (USD)"
    from optimism.core.ez_dex_swaps
    where EVENT_NAME = 'Swap'
    and SYMBOL_IN = 'USDC'
    and SYMBOL_OUT = 'OP'
    and BLOCK_TIMESTAMP >= Current_date - 60
    and BLOCK_TIMESTAMP < Current_date
    group by 1
    ),
    price as (
    select
    date_trunc(day, hour)::date as date,
    avg(price) as price
    from optimism.core.fact_hourly_token_prices
    where symbol = 'OP'
    and hour >= Current_date - 60
    and hour < Current_date
    group by 1
    )
    select
    a.*,
    b.price
    from swap a join price b on a.date = b.date

    Run a query to Download Data