Documentation Index
Fetch the complete documentation index at: https://mathematicalcompany.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Volatility Suite
Horizon provides six volatility estimators implemented in Rust, plus ahz.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 return0.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
Thehz.volatility() pipeline function computes all estimators per cycle from a feed and injects a VolatilitySnapshot into ctx.params["vol"].
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
feed | str | required | Feed name to read prices from |
lookback | int | 100 | Maximum price history length per market |
ewma_span | int | 20 | EWMA span parameter |
rolling_window | int | 20 | Rolling vol window size |
annualize | bool | True | Multiply by sqrt(365) |
VolatilitySnapshot
The snapshot injected intoctx.params["vol"] is a frozen dataclass:
Choosing an Estimator
| Estimator | Data Needed | Efficiency | Best For |
|---|---|---|---|
| Close-to-close | Prices only | 1x | Tick data, simple strategies |
| Parkinson | High/Low | ~5x | Range-based analysis |
| Garman-Klass | OHLC | ~8x | When you have proper OHLC bars |
| Yang-Zhang | OHLC | ~14x | Markets with opening gaps |
| EWMA | Prices | Adaptive | Reactive volatility tracking |
| Rolling | Prices | 1x/window | Time-varying vol analysis |
best property automatically selects the highest-quality available estimate.