maybeyonassteth_price
    Updated 2022-11-28
    with steth_price as(
    select * from ethereum.token_prices_hourly
    where token_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    and hour=date(hour)
    -- and
    and hour >= getdate() - interval '90 days'
    ),
    eth_price as(
    select * from ethereum.token_prices_hourly
    where token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
    and hour=date(hour)
    -- and
    and hour >= getdate() - interval '90 days'
    )

    select
    s.hour,
    s.price as steth_price,
    e.price as eth_price,
    e.price/s.price as exchange_rate,
    s.price-e.price as steth_diff,
    case
    when (s.price-e.price) < 0 then 'red'
    else 'green'
    end as color
    from steth_price s
    join eth_price e on s.hour=e.hour
    Run a query to Download Data