Skip to main content
Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com
What is this? In tick data, sampling too frequently inflates volatility estimates (microstructure noise) while sampling too infrequently loses information. The volatility signature plot shows you this tradeoff and finds the optimal sampling frequency. Use it to calibrate your volatility estimates and detect when market microstructure noise is unusually high.

Volatility Signature

Horizon provides Rust-native tools for analyzing microstructure noise in prediction market tick data. The volatility signature plot reveals how realized volatility estimates vary with sampling frequency, enabling you to separate true volatility from market noise and find the optimal sampling interval.

Signature Plot

Realized volatility at multiple sampling frequencies. Visualize the noise-to-signal transition.

Two-Scale Realized Vol

Zhang-Mykland-Ait-Sahalia estimator. Bias-corrected volatility robust to microstructure noise.

Noise Variance

Estimate the variance of microstructure noise from the autocovariance of returns.

Optimal Sampling

Find the sampling frequency that minimizes total estimation error (bias + variance).

hz.volatility_signature

Compute realized volatility at multiple sampling frequencies to produce a volatility signature plot. At very high frequencies, microstructure noise inflates the estimate. At very low frequencies, estimation variance increases. The signature plot reveals both effects.

SignaturePlot Type


hz.two_scale_realized_vol

The Zhang-Mykland-Ait-Sahalia (2005) Two-Scale Realized Volatility (TSRV) estimator. Combines a fast-scale (tick-by-tick) and slow-scale (subsampled) estimator to cancel out microstructure noise bias.
Returns float: the bias-corrected realized volatility estimate.
TSRV is the recommended estimator when you suspect microstructure noise in your tick data. It converges at rate n^(-1/6) even in the presence of noise, versus n^(0) for standard realized volatility (which does not converge at all when noise is present).

hz.noise_variance_estimate

Estimate the variance of microstructure noise from the first-order autocovariance of high-frequency returns. Under standard noise models, the noise variance equals the negative of the first autocovariance.
Returns float: estimated noise variance. Returns 0.0 if the autocovariance is positive (indicating no noise or trending behavior).

hz.optimal_sampling_frequency

Find the sampling frequency that minimizes the total mean squared error of the realized volatility estimator. This balances the bias from microstructure noise (dominant at high frequencies) against the estimation variance (dominant at low frequencies).
Returns int: the optimal number of ticks between samples for realized volatility estimation.
The optimal frequency depends on the noise-to-signal ratio. Noisier markets (e.g., illiquid prediction markets with wide spreads) require lower sampling frequencies. The formula follows Bandi-Russell (2008): n_opt ~ (noise_var / integrated_quarticity)^(1/3) * T^(2/3).

Pipeline Integration

hz.vol_signature_analyzer

Creates a pipeline function that computes the volatility signature and TSRV from a feed and injects microstructure statistics into ctx.params.

Injected Parameters


Example: Microstructure Analysis


Mathematical Background

The signature plot computes realized volatility RV(delta) = sum of squared returns at sampling interval delta. In the absence of noise, RV(delta) is approximately constant for all delta. In the presence of microstructure noise, RV(delta) is inflated at small delta (high frequency) due to the noise term 2 * n * noise_var, where n is the number of returns. The plot should flatten as delta increases past the noise-dominated region.
TSRV combines two estimators:
  • Fast scale (all ticks): RV_fast = sum(r_i^2), biased upward by noise
  • Slow scale (subsampled): RV_slow = (1/K) * sum over K subgrids of subsampled RV
TSRV = RV_slow - (n_bar / n) * RV_fast, where n_bar is the average subsample size. The noise terms cancel, yielding a consistent estimator.
Under the model: observed_price = true_price + noise, where noise is i.i.d., the first-order autocovariance of returns equals negative noise_var. This follows because noise creates negative serial correlation in returns (a positive noise shock is partially reversed in the next return). The estimator: noise_var = -Cov(r_t, r_(t+1)).
The volatility signature requires at least 20 tick observations to produce meaningful results. For markets with very few daily trades, consider accumulating data over multiple days before running the analysis.