Skip to content
All library documents

Fitting Ornstein–Uhlenbeck Models and Selecting a Two-Asset Spread

Code Stratmill research code

Summary

This module fits an Ornstein–Uhlenbeck (OU) process to either one price series or a spread formed from two asset price series. It estimates the long-run level, reversion speed, and volatility by maximizing a likelihood for discretely sampled observations, with the time step set from daily, monthly, or yearly input frequency.

For two assets, it builds a log-price spread for candidate hedge ratios, searches a fixed grid of ratios, and selects the ratio whose fitted OU model has the highest likelihood. The code also includes two infinite-series helper functions, but does not explain their role in threshold selection. It provides implementation details rather than trading results or validation. The fitting assumptions, data quality requirements, and robustness of the grid search are not assessed, so the fitted parameters should not be taken as evidence that a spread is reliably mean-reverting or profitable.

Key ideas

  • The class estimates OU parameters from a single series or a spread of two asset prices.
  • It uses a likelihood objective based on the discrete-time OU transition variance.
  • For a pair, it searches a grid of hedge ratios and selects the one with the strongest fitted likelihood.
  • The code specifies frequency-based time steps but offers no empirical validation or trading performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.