AlihastamGain or Lose on Swaps
    Updated 2022-06-13
    with table1 as (
    select
    hour as steth_hour,
    avg(price) as steth
    from ethereum.core.fact_hourly_token_prices
    where token_address like '0xae7ab96520de3a18e5e111b5eaab095312d7fe84'
    group by 1 ),
    table2 as (
    select
    hour as eth_hour,
    avg(price) as eth
    from ethereum.core.fact_hourly_token_prices
    where symbol like 'WETH'
    group by 1
    )
    select
    steth_hour,
    (steth- eth) / (eth) as "gain and lose", 0 as peg
    from table1 left outer join table2 on steth_hour = eth_hour
    where steth_hour > CURRENT_DATE - 200
    Run a query to Download Data