Every Quant

Strategy guide

Pairs trading and statistical arbitrage

Short answer

Pairs trading is a strategy that aims to be market-neutral: it buys an asset and sells a closely related asset when the price gap between them moves unusually wide, betting the gap will narrow again. Statistical arbitrage extends the idea to many assets at once, trading small, temporary mispricings measured by a statistical model.

See plansCore $299 a month · starter pack $99 for 5 entries

The appeal is clear. Instead of betting on whether a market goes up or down, the trader bets on the relationship between assets. If both fall together, the long and short sides largely offset. What matters is whether the gap between them behaves as expected.

How it works

In outline, a pairs trade has three parts. First, find two assets with an economic reason to move together, such as companies in the same industry with similar businesses, different share classes of the same company, or a fund and the basket it holds. The relationship should have a reason, not only a history. Second, combine them into a spread that does not simply drift with the market. A pair of prices can each wander freely while the spread between them stays anchored; statisticians call this cointegration. Third, hold the rich side short and the cheap side long while the spread looks unusually stretched, on the view that the anchor will pull it back.

How the pair is chosen, how the spread and its stretch are measured, and when to enter and leave a position are the design choices that separate one version from another. The full entries cover them.

Statistical arbitrage scales this up. Instead of a single pair, the trader models each asset's price against a set of common drivers, such as the market, its industry and a small number of statistical factors. The part of each move that the model does not explain, the residual, is treated as a temporary mispricing. The portfolio buys assets with unusually weak residuals and sells assets with unusually strong ones, keeping overall exposure to the market and the factors close to zero.

Why it can work (market behaviour)

The spread between related assets can revert because the same forces that set their values keep pulling them back together:

  • Shared fundamentals. Companies in the same business face the same demand, costs and regulation. If the prices drift apart without news that affects only a single company, buyers and sellers tend to close the gap.
  • Temporary demand shocks. A large order in a single stock, an index change, or a fund flow can push its price away from its peers for a while. The pairs trader provides liquidity to that flow and expects the gap to close as the pressure fades.
  • Law of one price. When assets are near-identical claims on the same cash flows, such as dual-listed shares or a fund and its holdings, arbitrage pressure keeps them close.
  • Slow diffusion of news. News may reach some related stocks faster than others. A gap that opens while the market catches up can narrow as information spreads.
  • Hedged exposure. Because the trade is long and short, market moves largely cancel. That makes the trade a purer bet on the relationship, and it lets the trader hold many small, low-correlation positions.

When it fails

Pairs trading looks safe because it is hedged. Its real risks are less visible.

  • The relationship breaks. A merger, a lawsuit, a new product, a change in strategy or a fraud can permanently change the value of a single side. The spread then keeps widening, and the trade loses on both legs.
  • Divergence before convergence. Even when the spread will eventually narrow, it can widen much further first. Traders with limited capital may be forced out at the worst time. Economists call this a limit to arbitrage.
  • Crowding and deleveraging. Many funds run similar models. When some of them cut positions at once, spreads that looked independent can all move against the trader together. Khandani and Lo documented a well-known episode of this kind.
  • Shorting costs and recalls. Short positions need borrowed shares. Borrow fees can rise, shares can be recalled, and hard-to-borrow stocks may be the very ones that look rich.
  • Competition. As more capital competes for the same mispricings, competition may reduce simple opportunities.
  • Model risk. Hedge ratios, factor models and cointegration estimates all change over time. A spread built on a stale model can carry hidden market or industry exposure.

Main variants

VariantMarket behaviour it relies onWhen it tends to fail
Distance-method pairsPrices that moved together tend to keep doing soStructural change at a single company
Cointegration pairsAn economic link anchors the spreadThe link weakens or breaks
Time-varying hedge ratiosThe relationship shifts slowly over timeSudden breaks a slow model cannot follow
Factor-residual statistical arbitrageResidual moves after removing common drivers tend to fadeCrowded deleveraging and factor shocks
Fund versus basket arbitrageA fund should trade near the value of its holdingsStress when creation and redemption slow
Share class and dual-listing arbitrageClaims on the same cash flows should price alikeLegal, tax or access barriers that persist
Cross-asset relative valueRelated markets, such as a commodity and its producers, stay linkedSupply shocks that hit a single side

Pairs trading is mean reversion applied to a spread instead of a single price, so most of the ideas on that page apply here too.

How traders test it

Pairs and statistical arbitrage tests are prone to hidden biases. A careful test usually includes:

  1. A clear economic reason. Prefer pairs with a real link. Searching thousands of combinations for the closest-fitting spreads finds many pairs that are linked by chance.
  2. Separate formation and trading periods. Choose pairs and estimate hedge ratios on an earlier period, then trade them on a later period the selection did not see.
  3. Survivorship-free data. Include delisted and merged companies. Pairs that broke up through bankruptcy or takeover are the ones that teach the most.
  4. Realistic short-selling. Include borrow fees, the chance that shares are unavailable, and recalls.
  5. Costs on both legs. Every trade has a long leg and a short leg, so spreads, commissions and slippage count twice.
  6. Stress periods. Study crowded deleveraging episodes and market crashes on their own. A spread strategy that looks smooth in normal times can hide large losses there.
  7. Model stability. Re-estimate the hedge ratios and factors through time and check that the results do not depend on a single choice of window or threshold.

Common mistakes

  • Mistaking correlation for cointegration. Prices that move together day to day can still drift apart for good. Cointegration, not correlation, is the property that matters.
  • Data mining for pairs. Testing huge numbers of combinations is certain to make some look great in the past by chance.
  • No failure exit. A spread that keeps widening may be telling the trader the relationship has changed.
  • Ignoring the short side. Borrow costs and recalls can turn a good-looking trade into a loss.
  • Hidden factor exposure. A book of pairs can quietly lean toward an industry, a style or the market, and lose when that exposure moves.
  • Too much leverage. Because each spread looks calm, traders often lever up. Leverage is what turns a divergence into a forced exit.

Key terms

A pair is a set of related assets whose prices have tended to move together. The spread is the difference, or a scaled ratio, between the prices of the assets in the pair. Cointegration is a statistical property in which a combination of prices tends to move back toward a stable level, even if each price wanders on its own. Correlation measures how closely price changes move together, which is related to cointegration but not the same thing. Convergence describes the spread moving back toward its usual level, and divergence describes it moving away. A hedge ratio sets how much of each asset is held so that the pair is balanced. A structural break is a lasting change in the relationship between the assets.

Pairs trading is a form of statistical arbitrage and a close cousin of mean reversion. General mean reversion looks at a single price against its own history, while pairs trading looks at the relationship between related prices. Statistical arbitrage often extends the idea to large baskets of securities at once. Pairs trading also differs from true arbitrage, where a price gap is locked in with little risk. In pairs trading, the gap may keep widening and the relationship may never come back. Compared with factor investing, which holds broad portfolios based on shared traits, pairs trading focuses on specific relationships between a small number of assets.

Risks and costs in practice

The main risk is that the relationship breaks. A merger, a change in business, new rules or a shock to a single company can end the link between the assets, so the spread keeps widening. Losses can then grow while the position looks more attractive on paper. Costs matter because a pair needs a trade in each asset every time, and short selling brings borrowing fees and the risk of a recall. Crowding is another risk: when many traders hold similar pairs, a forced exit by some can push spreads wider for all.

Questions to ask before building a strategy of this kind

  • Why should the assets in the pair stay linked, beyond the fact that they moved together in the past?
  • How is a broken relationship recognised, and what happens to the position then?
  • Are short-selling costs, borrowing limits and both legs of each trade included in the research?
  • How were pairs chosen, and how many candidate pairs were examined before choosing?
  • Does the idea hold outside the period used to find the pairs?

Where to start reading

Gatev, Goetzmann and Rouwenhorst wrote a widely cited study of pairs trading in stocks. Engle and Granger set out the theory of cointegration that much of this work rests on. Shleifer and Vishny explained why arbitrage has limits when traders depend on outside capital. Do and Faff examined how pairs trading changed over time, Avellaneda and Lee studied statistical arbitrage more broadly, and Khandani and Lo examined a sudden, crowded unwind of similar strategies.

Unlock the full library. Members get written entries for individual pairs and statistical arbitrage strategies: the mechanics in words, the main design choices and the risk notes, plus a prompt to study each idea with your own AI. See plans

Education only. Not investment advice. Past behaviour of a strategy type does not predict results.

Entries

Entries for this part of the library are being written and checked.

Questions people ask

What is pairs trading in simple terms?

Pairs trading is buying an asset and selling a closely related asset at the same time when their prices drift unusually far apart. The trader expects the gap to narrow again. Because the positions offset each other, broad market moves matter less than the relationship between the pair.

What is the difference between pairs trading and statistical arbitrage?

Pairs trading usually means trading a single spread between a pair of related assets. Statistical arbitrage applies the same logic to a large portfolio, using a model to find many small, temporary mispricings at once. Statistical arbitrage relies more on diversification and less on any single relationship.

What is cointegration in pairs trading?

Cointegration means that a combination of the prices, usually the spread, tends to stay anchored even though each price wanders on its own. It is the statistical property that makes a spread mean-reverting. Correlation alone is not enough, because correlated prices can still drift apart for good.

Is pairs trading risk free?

No. The main risks are that the relationship breaks, that the spread widens much further before it narrows, and that crowded funds unwind similar trades at the same time. Short-selling costs and recalls add risk too.

How do you find pairs to trade?

Most traders start with an economic link: same industry, similar business, shared inputs, or claims on the same cash flows. They then test the spread for stability and cointegration on past data and check the result on later data. Pure data searches across thousands of combinations tend to find chance relationships.

Can you do pairs trading in Python?

Yes. Common libraries handle the regression, cointegration tests and z-scores. The hard parts are clean survivorship-free data, realistic short-selling costs, and keeping pair selection separate from the period used to judge the trades.

Papers

Written and checked by the Every Quant research team · Updated . How we write and check entries: methods.