The Ornstein-Uhlenbeck process and pairs trading

Perhaps the most widely known form of statistical arbitrage is called Pairs Trading. In this general strategy, we start first by picking two stocks which are highly related to one another (either by correlation, cointegration, or both). One method for finding such pairs is to use a network graph like a Minimum Spanning Tree. A filtered correlation network quickly summarizes the set of available tradable relationships.

Once we have found a pair its necessary to define a model to generate trading signals. One extremely popular model is the Ornstein-Uhlenbeck (OU) process, a stochastic differential equation defined as:

dx_t = \theta (\mu-x_t)\,dt + \sigma\, dW_t

Roughly speaking, this describes the motion of a particle under friction, where:

  • x_t is the current particle position
  • theta is a mean reversion constant
  • mu is the mean particle position
  • sigma is a constant volatility
  • dW_t is a Wiener process (Brownian motion)

This process is mean-reverting subject to random shocks from the random walk component. In fact, the farther the distance between the particle’s current position and its long term mean, the greater the force exerted to bring the particle back to its mean. 

You can see how this could be useful for trading the spread between two stocks. We define an equilibrium, or long term mean, and attempt to buy the spread when it is below the mean and sell above it. If we model the spread between the pair as an OU process, then the further the spread gets from its mean, the bigger we want to trade.

Using an unmodified OU process as your trading model might work for a time, but over the long run it is a recipe for a blowup. LTCM offers an example of a classic convergence trade blowup: the further a relationship gets out of alignment the bigger you trade, until you reach the point where you don’t have anymore capital to throw at the trade. Its at this point you can lose it all.

Better then to modify this useful process to include a stop-loss of sorts. The bread and butter pairs trade, so to speak, usually occurs when a small divergence in the spread returns to an equilibrium. In practice, when the divergence from equilibrium becomes too great we might not want to fade it at all. Instead of offering a juicy trading opportunity, large movements in spread prices might signal a change in long term equilibrium levels, or even a shift in the underlying relationship between the pair.

One simple way to modify the trading model is to define a band around your equilibrium and put hard limits on the size of the position you can take up to the band limits.

A more elegant solution comes from generalizing the OU process itself, as presented in the paper:

Optimal Portfolio Selection in Nonlinear Arbitrage Spreads [SSRN]

…we introduce a nonlinear generalization of OU which jointly captures several important risk factors inherent in arbitrage trading. While these factors are absent from the standard OU, we show that considering them yields several new insights into the behavior of rational arbitrageurs: Firstly, arbitrageurs recognizing these risk factors exhibit a diminishing propensity to exploit large mispricings. Secondly, optimal investment behavior in light of these risk factors precipitates the gradual unwinding of losing trades far sooner than is entailed in existing approaches including OU… data shows that incorporating these risks renders our model’s risk-management capabilities superior to both OU and a simple threshold strategy…

In this paper, the author’s introduce a nonlinearity to the process where the strategy reaches a limit of how much capital to allocate to fading the movement in the spread. Visually comparing the optimal strategy position implied by both processes shows the stop-loss in action. The red line represents the optimal trading position under the OU model, while the green represents the optimal position of the nonlinear model.

paperThis model parallels the risk management techniques used by successful stat arb practioners. Every good trader has to stay humble; automated Quant traders should be no exception.

Interested in resources for Pairs Trading?

Check out the release of SliceMatrix: a unique tool for visualizing the stock market, including views of filtered correlation networks and minimum spanning trees


Want to learn how to mine social data sources like Google Trends, StockTwits, Twitter, and Estimize? Make sure to download our book Intro to Social Data for Traders

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 277 other followers


Lead image derivative work licensed under CC BY-SA 3.0 from Soler97

Citations: Alsayed, Hamad and McGroarty, Frank, Optimal Portfolio Selection in Nonlinear Arbitrage Spreads (May 29, 2010). Available at SSRN: or

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s