wxyz-erDaily Swap Fee
    Updated 2022-10-26
    with swaps_eth as (
    select
    date_trunc('day',swaps.block_timestamp) as date,
    'ETH Sushi' as chain,
    avg(tx_fee) as swap_fee,
    swap_fee*avg(price) as swap_fee_usd
    from ethereum.sushi.ez_swaps swaps
    left join ethereum.core.fact_transactions txs on swaps.tx_hash=txs.tx_hash
    left join ethereum.core.fact_hourly_token_prices prices on date_trunc('hour',hour)=date_trunc('hour',swaps.block_timestamp)
    where swaps.block_timestamp >= '2022-05-12' and status='SUCCESS' and token_address= '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    GROUP BY date
    ORDER BY date

    ),
    swaps_op as (
    select
    date_trunc('day',swaps.block_timestamp) as date,
    'OP Sushi' as chain,
    avg(tx_fee) as swap_fee,
    swap_fee*avg(price) as swap_fee_usd
    from optimism.sushi.ez_swaps swaps
    left join optimism.core.fact_transactions txs on swaps.tx_hash=txs.tx_hash
    left join ethereum.core.fact_hourly_token_prices prices on date_trunc('hour',hour)=date_trunc('hour',swaps.block_timestamp)
    where swaps.block_timestamp >= '2022-05-12' and status='SUCCESS' and token_address= '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    GROUP BY date
    ORDER BY date
    )
    select * from swaps_eth
    UNION
    select * from swaps_op
    Run a query to Download Data