Yousefi_1994Optimistic Bears - Daily Swaps
    Updated 2022-11-09
    with sushi_swap_transactions as (
    select
    block_timestamp,
    tx_hash,
    origin_from_address,
    amount_in_usd
    from optimism.sushi.ez_swaps
    where block_timestamp::date >= '2022-07-01' and block_timestamp::date <= '2022-07-31'
    and amount_in_usd is not null
    and amount_in_usd > 0
    ),
    velodrome_swap_transactions as (
    select
    block_timestamp,
    tx_hash,
    origin_from_address,
    amount_in_usd
    from optimism.velodrome.ez_swaps
    where block_timestamp::date >= '2022-07-01' and block_timestamp::date <= '2022-07-31'
    and amount_in_usd is not null
    and amount_in_usd > 0
    ),
    all_swap_transactions as (
    select *, 'Sushiswap' as dex from sushi_swap_transactions
    union all
    select *, 'Velodrome' as dex from velodrome_swap_transactions
    ),
    op_token_price as (
    select
    hour::date as "Days",
    avg(price) as "OP Price"
    from optimism.core.fact_hourly_token_prices
    where hour::date >= '2022-07-01' and hour::date <= '2022-07-31'
    and token_address = '0x4200000000000000000000000000000000000042'
    group by "Days"
    ),
    Run a query to Download Data