MLDZMNOPvs8
    Updated 2022-10-05
    with tb2 as (SELECT
    BLOCK_TIMESTAMP::date as day,
    count(distinct tx_hash) as swap_no,
    count(distinct ORIGIN_FROM_ADDRESS) as swappers,
    sum(AMOUNT_IN_USD) as volume,
    volume/swap_no as average_volume
    FROM optimism.velodrome.ez_swaps
    where SYMBOL_IN='OP'
    group by 1 having volume is not null
    union all
    SELECT
    BLOCK_TIMESTAMP::date as day,
    count(distinct tx_hash) as swap_no,
    count(distinct ORIGIN_FROM_ADDRESS) as swappers,
    sum(AMOUNT_IN_USD) as volume,
    volume/swap_no as average_volume
    FROM optimism.sushi.ez_swaps
    where SYMBOL_IN='OP'
    group by 1 having volume is not null),

    tb3 as (select
    date_trunc('day',HOUR) as day,
    avg(price) as OP_price
    from optimism.core.fact_hourly_token_prices
    where SYMBOL='OP'
    group by 1)

    select
    tb2.day as day,
    swap_no,
    volume,
    average_volume,
    OP_price
    from tb2 join tb3 on tb2.day=tb3.day
    Run a query to Download Data