nitsWETH vs WBTC Prices
    Updated 2022-11-23
    with prices as
    (SELECT date(hour) as day, avg(price) as avg_price
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
    GROUP by 1
    ),
    prices1 as
    (SELECT date(hour) as day_, avg(price) as avg_price_
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WETH'
    GROUP by 1
    ),
    eth as
    (SELECT *, (avg_price-avg_price_)/avg_price_ *100 as percent_change,'WETH' as token,
    (avg_price-(SELECT avg_price from prices where day= CURRENT_DATE - {{n_last_days}} ))/avg_price_ *100 as percent_change_cumulative
    from prices
    inner join prices1 on day = day_ + 1),

    prices_ as
    (SELECT date(hour) as day, avg(price) as avg_price
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WBTC'
    GROUP by 1
    ),
    prices1_ as
    (SELECT date(hour) as day_, avg(price) as avg_price_
    from ethereum.core.fact_hourly_token_prices
    where date(hour) >= CURRENT_DATE - {{n_last_days}} and symbol ilike 'WBTC'
    GROUP by 1
    ),
    wbtc as
    (SELECT *, (avg_price-avg_price_)/avg_price_ *100 as percent_change,'WBTC' as token,
    (avg_price-(SELECT avg_price from prices_ where day= CURRENT_DATE - {{n_last_days}} ))/avg_price_ *100 as percent_change_cumulative
    from prices_
    inner join prices1_ on day = day_ + 1)

    Run a query to Download Data