KaskoazulUntitled Query
Updated 2023-01-22
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
›
⌄
SELECT
--COALESCE(t.block_timestamp::date, b.block_timestamp::date) AS fecha
p.timestamp::date AS fecha
, COUNT(1) AS data_points
, AVG(price_usd) AS avg_price
, AVG(avg_price) OVER (ORDER BY fecha ROWS BETWEEN 200 PRECEDING AND CURRENT ROW) AS rolling_price_200MA
, AVG(avg_price) OVER (ORDER BY fecha ROWS BETWEEN 90 PRECEDING AND CURRENT ROW) AS rolling_price_90MA
, AVG(avg_price) OVER (ORDER BY fecha ROWS BETWEEN 30 PRECEDING AND CURRENT ROW) AS rolling_price_30MA
FROM
near.core.fact_prices p
WHERE
symbol = 'wNEAR'
GROUP BY
fecha
ORDER BY
fecha DESC
Run a query to Download Data