Yousefi_1994Compare ETH daily price with Gas used in Sushiswap transactions
    Updated 2022-06-08
    with sushiswap_gas_used as (
    select swaps.block_timestamp::date as days,
    sum(transactions.gas_used) as gas_used_amount,
    sum(transactions.gas_used/1e9) as gas_used_ether_amount
    from ethereum.core.ez_dex_swaps swaps
    join ethereum.core.fact_transactions transactions using(tx_hash)
    where swaps.platform = 'sushiswap'
    and swaps.block_timestamp::date >= '2022-01-01'
    group by days
    order by days
    ),
    eth_price as (
    select
    hour::date as days,
    avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where token_address is null
    and symbol is null
    and hour(hour) = 0
    and hour::date >= '2022-01-01'
    group by days
    order by days
    )

    select
    sushiswap_gas_used.days as days,
    sushiswap_gas_used.gas_used_amount as gas_used_amount,
    sushiswap_gas_used.gas_used_ether_amount,
    eth_price.eth_price as eth_price
    from sushiswap_gas_used
    left join eth_price using(days)
    Run a query to Download Data