Quant Memo
Advanced

Pairs Trading

The original convergence trade, find two cointegrated assets, trade the mean-reverting spread with z-score entry and exit rules, size by the half-life of reversion, and understand why the relationship eventually breaks.

Prerequisites: Ordinary Least Squares (OLS), Mean Reversion

Pairs trading is the ancestor of all convergence strategies, reputedly born at Morgan Stanley in the 1980s. The idea is disarmingly simple: two securities driven by the same economic forces (Coke and Pepsi, two oil majors) should move together; when they diverge, bet that the gap closes. The rigor lives in defining "move together" precisely (cointegration, not correlation), in the entry/exit mathematics, and in understanding why every pair eventually stops working.

Correlation is not enough, you need cointegration

Two stocks can be highly correlated in returns yet drift arbitrarily far apart in price (both trend up, but one faster), a spread built on correlation has no anchor to trade against. What you need is cointegration: a linear combination of the two price levels that is stationary (mean-reverting), even though each price is individually a random walk (integrated of order 1). Formally, prices PtA,PtBP^A_t, P^B_t are cointegrated if there is a hedge ratio β\beta such that the spread

st=PtAβPtBμs_t = P^A_t - \beta\, P^B_t - \mu

is stationary. Estimate β\beta by the Engle-Granger method: regress PtAP^A_t on PtBP^B_t by Ordinary Least Squares (OLS) (the cointegrating regression), then test the residuals for a unit root (Augmented Dickey-Fuller). Reject the unit root ⇒ the spread is stationary ⇒ tradeable. Correlation says the assets move together short-term; cointegration says the spread has a home it returns to, only the latter gives you something to converge to.

The spread as an Ornstein-Uhlenbeck process

Model the stationary spread as a continuous-time mean-reverting (OU) process, the same object as in Mean Reversion:

dst=θ(μst)dt+σdWt.ds_t = \theta(\mu - s_t)\,dt + \sigma\, dW_t.

Here θ>0\theta>0 is the speed of reversion, μ\mu the long-run mean, σ\sigma the instantaneous volatility. Two quantities drive the trade:

  • Stationary (equilibrium) standard deviation: σeq=σ/2θ\sigma_{eq} = \sigma/\sqrt{2\theta}, the natural scale of spread deviations, used to normalize into a z-score.
  • Half-life of reversion: t1/2=ln2θt_{1/2} = \dfrac{\ln 2}{\theta}, how long a shock takes to decay halfway back. The half-life sets your holding period and, with Transaction Costs, whether the pair is worth trading at all: a half-life of days is great; a half-life of a year means capital is tied up too long for the edge.

Entry and exit: the z-score rule

Normalize the spread to a z-score relative to its own history:

zt=stμσeq.z_t = \frac{s_t - \mu}{\sigma_{eq}}.

The canonical rule: enter when zt|z_t| exceeds a threshold (commonly z=2z=2), if zt=+2z_t = +2 the spread is stretched high, so short AA / long β\beta units of BB; if zt=2z_t=-2, the reverse. Exit when the spread reverts to z=0z=0 (or a small band), booking the convergence. A stop at, say, z=3|z|=3 or 44 caps the loss if the relationship has broken rather than merely stretched. The trade is (dollar- and ideally beta-) neutral by construction, you own the spread, not the market, making it the two-asset special case of a cross-sectional, market-neutral strategy.

Why the thresholds make money

Entering at z=±2z=\pm2 and exiting at 00 works because the OU process is expected to revert: conditional on sts_t, the expected change is θ(μst)dt\theta(\mu - s_t)\,dt, which points back toward μ\mu with force proportional to the deviation. At z=+2z=+2 the expected drift is strongly negative, so shorting the spread has positive expected return over the reversion horizon. You are, in effect, selling insurance against the spread not reverting, collecting the reversion premium in the (usual) case it does, and taking a loss in the (rare) case the cointegration has broken. The threshold trades off frequency against edge: a low entry threshold trades often but each trade has small expected convergence; a high threshold trades rarely but each move is large and reliable. The optimal threshold given costs and θ\theta can be solved as an optimal-stopping problem.

Worked example

Two refiners: the cointegrating regression gives hedge ratio β=1.2\beta = 1.2 and residual spread with mean μ=0\mu=0, equilibrium sd \sigma_{eq}=\1.50,andestimated, and estimated \thetaimplyingahalflifeof10tradingdays.Todaythespreadsitsatimplying a half-life of 10 trading days. Today the spread sits at+$3.00,i.e., i.e. z = 3.00/1.50 = +2.0.Youshort1unitof. You short 1 unit of Aandbuy1.2unitsofand buy 1.2 units ofB,adollarneutralposition.Expectedpath:thespreadrevertstoward0witha10dayhalflife,soin 10daysyouexpectroughlyhalfthe, a dollar-neutral position. Expected path: the spread reverts toward 0 with a 10-day half-life, so in ~10 days you expect roughly half the $3 gap (\1.50) to close; you exit near z=0z=0 having captured the convergence, minus two round-trips of cost. If instead the spread widens to z=+4z=+4 (\6), your stop fires, you take the loss and, critically, re-examine whether the cointegration still holds.

Why pairs trading decays

Pairs trading is a textbook case of Alpha Decay, and its failure modes are instructive:

  • Structural breaks. Cointegration is an empirical relationship, not a law. A merger, a spinoff, a new product, a credit event, or a management change can permanently reprice one leg, the spread does not revert, it re-levels, and you are short a widening gap. This is the dominant risk and why stops are mandatory.
  • Crowding. Gatev-Goetzmann-Rouwenhorst documented strong pairs returns in 1962–2002, but profitability fell sharply afterward as the strategy became widely known and automated, the edge was arbitraged down.
  • Look-ahead in the spread. Estimating β\beta, μ\mu, and σeq\sigma_{eq} on the full sample and then "trading" it is a classic backtest bug; parameters must be estimated on a rolling in-sample window only.
  • The single-pair problem. One pair is a tiny-breadth bet dominated by idiosyncratic break risk. The fix, trade hundreds of relationships at once so no single break matters, is precisely the leap from pairs trading to Statistical Arbitrage.

In interviews

Lead with the distinction that pairs trading needs cointegration, not correlation, correlated prices can diverge forever, cointegrated ones share a stationary spread with a mean to trade against, and describe the Engle-Granger recipe (cointegrating OLS regression, then ADF test on residuals). Model the spread as an OU process, define the half-life ln2/θ\ln2/\theta (holding period) and the z-score entry (z=2|z|=2)/exit (z=0z=0)/stop rules, and explain why they profit: at wide zz the OU drift points strongly back to the mean, so you are paid the reversion premium. The failure question, "why does a pair stop working?", is answered by structural breaks (the relationship re-levels rather than reverts) and crowding, and the natural extension is to diversify break risk across many pairs, i.e. Statistical Arbitrage.

Related concepts

Used in strategies

Practice in interviews

Further reading

  • Gatev, Goetzmann & Rouwenhorst (2006), Pairs Trading: Performance of a Relative-Value Arbitrage Rule
  • Engle & Granger (1987), Co-integration and Error Correction
  • Vidyamurthy, Pairs Trading: Quantitative Methods and Analysis
ShareTwitterLinkedIn