Historical volatility
Select the data
WITH
'2024-01-01' AS start_date,
'2024-12-31' AS end_date,
30 AS window_days,
365 AS sessions_per_year,
candles AS (
SELECT toDate(start) AS day, open, high, low, close
FROM api.ohlcv(candle_duration_in_minutes = 1440)
WHERE exchange = 'binance'
AND market = 'BTC-USDT'
AND start >= start_date
AND start <= end_date
)day
open
high
low
close
Compute log returns and intraday range
day
close
log_return
hl_log_sq
Roll the 30-day window
day
vol_30d_cc_pct
vol_30d_park_pct
Notes on the estimators
Full example
window length
execution time
See also
Last updated