nitsAny Symbol Prices in the last n days
    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 '{{symbol}}'
    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 '{{symbol}}'
    GROUP by 1
    )

    SELECT *, (avg_price-avg_price_)/avg_price_ *100 as percent_change,
    (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


    -- LIMIT 100
    Run a query to Download Data