afonsoavg aETHc
    Updated 2023-01-13
    with t as (
    select
    a.hour::date as day,
    avg (a.price) as weth_price_usd,
    avg (b.price) as token_price_usd
    from ethereum.core.fact_hourly_token_prices a
    join ethereum.core.fact_hourly_token_prices b
    on a.hour::date = b.hour::date
    where a.token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' --WETH
    and b.token_address = '0xe95a203b1a91a908f9b9ce46459d101078c2c3cb' --aETHc
    group by 1
    )

    select avg(diff_ratio) as avg_diff_ratio from (
    select day,
    avg(weth_price_usd) as weth_price_usd,
    avg(token_price_usd) as token_price_usd,
    avg(token_price_usd / weth_price_usd) as diff_ratio
    from t
    group by day
    )
    Run a query to Download Data