Skip to content
All library documents

Simulating Cointegrated Price Pairs with AR(1) Processes

Code Stratmill research code

Summary

This module generates synthetic pairs whose relationship is defined by a hedge ratio and a mean-reverting cointegration error. It first simulates the change in one asset’s price as an autoregressive process, cumulatively sums those changes into a price series, and then constructs the other price so that the residual follows its own autoregressive process. The implementation offers both a statsmodels-based generator and a direct recurrence method, with adjustable drift, autoregressive coefficients, noise variance, and hedge ratio.

The broader class supports repeated simulations, parameter loading, plots, and estimation of hedge ratios with an Engle–Granger portfolio method. This makes it useful for studying how cointegration procedures behave on controlled data. The generated relationships rely on chosen model assumptions and do not establish that real assets are cointegrated or that a pairs strategy will be profitable. Results also depend on parameters and simulation settings, so they should be treated as synthetic research inputs rather than market evidence.

Key ideas

  • The simulator creates a price series by cumulatively summing AR(1) price changes.
  • A second series is constructed using a hedge ratio and a separately simulated AR(1) residual.
  • Parameters control drift, persistence, noise variance, and the relationship between the series.
  • The class can compare simulated hedge ratios with estimates from an Engle–Granger method.
  • Synthetic cointegration demonstrates behavior under assumptions but does not prove real-world trading value.

Tags

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