Skip to main content

Volatility Suite

Horizon provides six volatility estimators implemented in Rust, plus a hz.volatility() pipeline function that computes all of them per cycle and injects a VolatilitySnapshot into your strategy context.
Prediction markets trade 24/7 on a 365-day calendar. All estimators use sqrt(365) for annualization by default, which differs from the sqrt(252) convention used in equity markets.

Overview

Close-to-Close

hz.estimate_volatility() - standard deviation of log returns. Simple, widely used.

Parkinson

hz.parkinson_vol() - high/low range estimator. ~5x more efficient than close-to-close.

Garman-Klass

hz.garman_klass_vol() - OHLC estimator. Most efficient standard estimator.

Yang-Zhang

hz.yang_zhang_vol() - combines overnight jump + Rogers-Satchell. Handles opening gaps.

EWMA

hz.ewma_vol() - exponentially weighted, reactive to recent changes.

Rolling

hz.rolling_vol() - windowed realized vol series for time-varying analysis.

Rust Functions

All functions return 0.0 on insufficient or invalid data. All accept an annualize parameter.

hz.estimate_volatility

Standard deviation of log returns (close-to-close).

hz.parkinson_vol

Parkinson high/low range estimator. More efficient than close-to-close because it uses intra-period range information.

hz.garman_klass_vol

Garman-Klass OHLC estimator. The most statistically efficient standard estimator using open, high, low, close data.

hz.yang_zhang_vol

Yang-Zhang estimator combining overnight jump variance, open-to-close variance, and Rogers-Satchell range variance. The most robust OHLC estimator, especially when opening gaps are present.
Yang-Zhang requires at least 2 bars (for overnight returns). Returns 0.0 with fewer.

hz.ewma_vol

Exponentially weighted moving average volatility. More reactive to recent price changes than equal-weighted estimators.

hz.rolling_vol

Rolling windowed realized volatility series. Returns a list of vol values, one per window position.

Pipeline Function

The hz.volatility() pipeline function computes all estimators per cycle from a feed and injects a VolatilitySnapshot into ctx.params["vol"].

Parameters

VolatilitySnapshot

The snapshot injected into ctx.params["vol"] is a frozen dataclass:
Best priority order: yang_zhang > garman_klass > parkinson > ewma > realized

Choosing an Estimator

The pipeline’s best property automatically selects the highest-quality available estimate.