PnL ProfitEncyclopedia
🌐 English

Pairs Trading and Statistical Arbitrage

7 min read · Updated Nov 23, 2026
More in Algorithmic & Quant Trading

Pairs trading is a market-neutral strategy that buys one asset and shorts a closely related one when the price relationship between them stretches unusually far, betting that the gap will narrow. Statistical arbitrage, or stat arb, extends the idea to large portfolios of positions selected with statistical models. Both are forms of mean reversion applied to relative prices instead of single prices, and both depend on relationships that can weaken or break.

Key takeaways

  • Pairs trading profits from changes in the spread between two assets, not from the direction of the overall market.
  • Cointegration, meaning the spread itself tends to return to a stable level, matters more than correlation.
  • The hedge ratio sets how much of each asset to trade so the spread is balanced.
  • Entries and exits are usually defined by z-scores of the spread, plus stops for when the relationship breaks.
  • Published pairs-trading profits have declined over time, and crowded stat arb positions can unwind violently, as in August 2007.
On this page
  1. How pairs trading works
  2. Correlation vs cointegration
  3. Building the spread
  4. Entry and exit rules
  5. From pairs to statistical arbitrage
  6. Decay and crowding
  7. Worked example
  8. Common mistakes

How pairs trading works

The classic example is two companies in the same industry with similar businesses, such as two large oil producers, two payment networks or two share classes of the same company. Their prices are driven by many of the same factors. When one rises sharply relative to the other without a clear reason, a pairs trader shorts the outperformer and buys the underperformer. If the relationship holds, the gap closes and the trade profits whether the market as a whole rises or falls.

Pairs trading is often traced to quantitative groups on Wall Street trading desks in the 1980s, with a team at Morgan Stanley frequently credited. In a widely cited 2006 study, Gatev, Goetzmann and Rouwenhorst tested a simple rule on US stocks: match stocks whose normalized prices moved most closely together, then trade when they diverge. They found historical excess returns, but also that profits were lower in the later part of their sample, a pattern follow-up studies also reported.

Correlation vs cointegration

Correlation and cointegration are often confused, and the difference is important.

Concept What it measures Useful for pairs?
Correlation Whether two series' returns move up and down together from period to period Not enough by itself. Two highly correlated stocks can drift apart permanently
Cointegration Whether some combination of the two price series (the spread) is stationary, meaning it tends to return to a stable mean Yes. This is what a pairs trade actually bets on

Two stocks can have highly correlated daily returns while one slowly grows faster than the other for years. The spread then trends, and a trader shorting the "expensive" one loses steadily. Conversely, cointegrated series can have only moderate daily correlation but still keep a stable long-run relationship.

The Engle-Granger two-step method, introduced by Engle and Granger in 1987, is a common test: regress one price on the other to estimate the relationship, then test whether the residual spread is stationary. The Johansen test handles more than two assets. See correlation and portfolio risk for how correlation behaves across a portfolio.

Building the spread

Hedge ratio

The hedge ratio β says how many units of asset B offset one unit of asset A. It is often estimated by regressing the price of A on the price of B (or log prices) over a lookback window:

Spread = Price_A − β × Price_B

A dollar-neutral pair holds equal dollar amounts long and short. A beta-neutral pair adjusts for differences in market sensitivity. Hedge ratios drift, so many traders re-estimate them on a rolling window, or use a Kalman filter to update them continuously.

Half-life

The half-life estimates how long the spread typically takes to close half of a deviation from its mean. It comes from regressing the change in the spread on its previous level. A half-life of 5 to 20 days suits swing trading; a half-life of months ties up capital and increases the chance that the relationship breaks first.

import numpy as np
import statsmodels.api as sm
from statsmodels.tsa.stattools import coint

def pair_stats(a: np.ndarray, b: np.ndarray):
    """a, b: aligned arrays of prices (log prices are often used)."""
    beta = sm.OLS(a, sm.add_constant(b)).fit().params[1]
    spread = a - beta * b
    coint_p = coint(a, b)[1]          # Engle-Granger test; small p suggests cointegration
    lagged = spread[:-1]
    delta = np.diff(spread)
    lam = sm.OLS(delta, sm.add_constant(lagged)).fit().params[1]
    half_life = -np.log(2) / lam if lam < 0 else np.inf
    return beta, coint_p, half_life

Entry and exit rules

Most pairs systems trade the z-score of the spread: its distance from its rolling mean in standard deviations.

  • Entry: short the spread (short A, long β units of B) when z rises above about +2; buy the spread when z falls below about −2.
  • Exit: close when z returns near 0.
  • Stop: close if z reaches an extreme such as ±4, or if the trade lasts several times longer than the half-life.
  • Re-test: stop trading the pair if the cointegration test fails on recent data.

From pairs to statistical arbitrage

Statistical arbitrage applies the same logic at scale. Instead of one pair, a stat arb fund might hold hundreds or thousands of small long and short positions. Common approaches include:

  • Trading each stock against a basket of its sector peers.
  • Using factor models or principal component analysis to strip out market and sector moves, then trading the residual returns that are expected to revert. Avellaneda and Lee described this approach for US equities in a 2010 paper.
  • Short-horizon models that combine reversion signals with order-flow and volume information.

Despite the name, statistical arbitrage is not arbitrage in the riskless sense described in arbitrage strategies. It relies on probabilities that hold on average across many positions.

Decay and crowding

Edge decay

As more traders run similar models, the spreads they target close faster and opportunities shrink. Faster competitors capture the cleanest signals. Strategies that once held positions for weeks may now need to act in minutes, or not at all.

The August 2007 quant quake

In the week of August 6, 2007, many quantitative equity market-neutral funds suffered sudden, large losses. In a well-known analysis, Khandani and Lo argued that the likely trigger was one or more large funds rapidly unwinding positions, possibly to raise cash or cut risk elsewhere. Because many funds held similar long and short books, the forced selling pushed prices against all of them at once, triggering further de-risking. Much of the loss reversed within days, but funds that cut positions at the bottom locked it in. The lesson is that a strategy can be market-neutral and still carry concentrated crowding risk.

Worked example

Two stocks have an estimated hedge ratio of 1.2. Historically the spread A − 1.2 × B has averaged 2.00 dollars with a standard deviation of 0.50 dollars.

  • Today A trades at 51.50 dollars and B at 40.00 dollars. Spread = 51.50 − 1.2 × 40.00 = 51.50 − 48.00 = 3.50 dollars.
  • z = (3.50 − 2.00) / 0.50 = 3.0, above the +2 entry level, so the trader shorts the spread: short 1,000 shares of A (51,500 dollars) and buy 1,200 shares of B (48,000 dollars).
  • Two weeks later A is at 51.00 and B at 40.75. Spread = 51.00 − 48.90 = 2.10 dollars, z = 0.2, so the trader exits.
  • Short A profit: (51.50 − 51.00) × 1,000 = 500 dollars. Long B profit: (40.75 − 40.00) × 1,200 = 900 dollars. Total 1,400 dollars.
  • Check: the spread fell from 3.50 to 2.10, a change of 1.40 dollars, times 1,000 units of the spread = 1,400 dollars.

From that, subtract commissions on four legs, the spread paid on each, and the borrow fee on the short stock. Shorting mechanics and costs are covered in short selling.

Common mistakes

  • Choosing pairs by correlation alone. High correlation does not mean the spread will revert.
  • Mining thousands of pairs and trading the best backtests. With enough candidates, some pairs look cointegrated by chance. See overfitting and data snooping.
  • Ignoring structural changes. Mergers, spin-offs, new regulation or a change in business mix can break a relationship permanently.
  • No stop on the spread. A broken pair can keep diverging for months.
  • Underestimating short-side costs. Borrow fees, recalls and short-sale restrictions can erase thin edges.

FAQ

Is pairs trading risk-free?

No. The relationship between the two assets can break down, the spread can widen further before it narrows, and crowded positions can unwind suddenly. Pairs trading reduces exposure to market direction but adds other risks.

What is the difference between cointegration and correlation?

Correlation measures whether two assets' returns move together from period to period. Cointegration means a combination of their prices forms a spread that tends to return to a stable average, which is what a pairs trade relies on.

What z-score should I use for pairs trading?

Many traders enter around ±2 and exit near 0, with a stop at a larger value such as ±4. The best thresholds depend on costs, the half-life of the spread and the pair itself, and should be tested out-of-sample.

Does pairs trading still work?

Academic studies found that the returns of simple pairs-trading rules declined over time as the strategy became widely known. Opportunities still exist, but they tend to be smaller, faster and more competitive than in the past.

Educational content only. Nothing here is financial, investment, legal or tax advice. Trading carries a high risk of loss, and leveraged products can lose more than you deposit. Rules, fees and platform details change: check current terms with your broker, exchange or regulator before you trade.