pouya_22ETH Derivatives - ETH avg diff with aETH
    Updated 2022-09-13
    with eth_price as (select
    hour::date as eth_date,
    avg(price) as eth_usd
    from ethereum.core.fact_hourly_token_prices
    where token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' -- WETH
    group by 1),

    aeth_price as (select
    hour::date as aeth_date,
    avg(price) as aeth_usd
    from ethereum.core.fact_hourly_token_prices
    where token_address = '0x3a3a65aab0dd2a17e3f1947ba16138cd37d08c04' -- aETH
    group by 1),

    diff as (select
    eth_date,
    (aeth_usd - eth_usd) as diff_with_eth
    from eth_price join aeth_price on eth_date = aeth_date)

    select avg(diff_with_eth) from diff
    Run a query to Download Data