cypherETH Gas price
    Updated 2022-06-13
    with gas_prices as (select
    date_trunc('day', block_timestamp) as date,
    avg(gas_price) as avg_gas_price
    from ethereum.core.fact_transactions
    where date >= current_date() - 90
    group by date),
    steth_price as (select
    date_trunc('day', hour) as date,
    avg(price) as steth_price
    from ethereum.core.fact_hourly_token_prices
    where hour >= current_date() - 90
    and token_address = lower('0xae7ab96520de3a18e5e111b5eaab095312d7fe84')
    group by date),

    eth_price as (select
    date_trunc('day', hour) as date,
    avg(price) as eth_price
    from ethereum.core.fact_hourly_token_prices
    where hour >= current_date() - 90
    and token_address is null
    group by date),

    joined as (select * from steth_price
    left join eth_price using (date)),

    peg as (select *, steth_price/eth_price as "steth/eth"
    from joined)



    select * from gas_prices
    left join peg using (date)
    Run a query to Download Data