nitsAny Symbol Prices in the last n days
Updated 2022-11-23
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
›
⌄
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