# Pairs Trading

> Pairs trading buys one asset and shorts a related one when their spread stretches, betting it will converge. Learn pair selection, hedge ratios, z scores and risks.

Source: https://learn.tradelabsai.com/strategies/pairs-trading/  
Track: Strategies and Styles · Level: Advanced · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Pairs Trading", https://learn.tradelabsai.com/strategies/pairs-trading/

Pairs trading is a market neutral strategy that trades the relationship between two closely related assets rather than the direction of the market. When two assets that normally move together drift apart, a pairs trader buys the one that has fallen behind and shorts the one that has run ahead, expecting the gap to close. If the whole market rises or falls, the long and short positions largely offset each other, so profit depends mainly on the spread between them.

## How pairs trading works

1. **Find two related assets,** such as two companies in the same industry (Coca Cola and PepsiCo are the classic example), two share classes of the same company or an ETF and its main holdings.
2. **Measure the spread** between them, usually price A minus a hedge ratio times price B.
3. **Calculate how unusual the spread is** with a z score. See [Percentiles, Quantiles and Z-Scores](https://learn.tradelabsai.com/math/z-scores/).
4. **Enter** when the spread is stretched, for example beyond 2 standard deviations.
5. **Exit** when the spread returns to its average, or at a stop if it keeps widening.

```
spread = price A - (hedge ratio × price B)
z = (spread - average spread) / standard deviation of spread
```

## Choosing pairs

| Method | Idea | Strength | Weakness |
|---|---|---|---|
| Fundamental | Same industry, similar business | Economic reason to converge | Relationships can change |
| Correlation | High historical correlation of returns | Simple | Correlation does not mean the spread reverts |
| Cointegration | Statistical test that the spread is stationary | Directly tests reversion | Can break; many tests lead to false positives |
| Distance | Smallest historical gap in normalised prices | Used in early research | Ignores reasons for the link |

Correlation measures whether returns move together day to day; cointegration measures whether the spread between prices stays bounded. Two stocks can be highly correlated yet drift apart for years. See [Covariance and Correlation](https://learn.tradelabsai.com/math/covariance-and-correlation/) and [Cointegration](https://learn.tradelabsai.com/math/cointegration/).

## Hedge ratio

The hedge ratio sets how much of asset B to short for each unit of A. It is often estimated by regressing the price of A on the price of B. A dollar neutral pair holds equal dollar amounts long and short; a beta neutral pair adjusts for differences in market sensitivity. See [Regression Analysis](https://learn.tradelabsai.com/math/regression-analysis/) and [Alpha and Beta](https://learn.tradelabsai.com/portfolio/alpha-and-beta/).

**Example: A pairs trade**
Stock A trades at $60 and Stock B at $40. The estimated hedge ratio is 1.5, so the spread is 60 minus 1.5 × 40, or 0. Over the past year the spread has averaged 0 with a standard deviation of $2. After A drops on sector news, A is $55 and B is $40.50, so the spread is 55 minus 60.75, or minus $5.75, a z score of minus 2.9. The trader buys 300 shares of A ($16,500) and shorts 450 shares of B ($18,225). Three weeks later A is $59 and B is $40, giving a spread of minus $1. The long gains $1,200 and the short gains $225, for $1,425 before costs.

## Risks

- **Relationship breaks:** a merger, scandal or change in business model can permanently separate a pair. The spread never returns and losses grow. See [Structural Breaks and Regime Changes](https://learn.tradelabsai.com/math/regime-changes/).
- **Short selling costs and risks:** borrow fees, recalls and short squeezes. See [Short Selling](https://learn.tradelabsai.com/markets/short-selling/) and [Borrow Fees and Stock Loan Costs](https://learn.tradelabsai.com/orders/borrow-fees-and-stock-loan-costs/).
- **Spread can widen further** before converging, requiring capital and nerve.
- **Crowding:** in August 2007, many quantitative funds running similar market neutral strategies suffered sharp losses at the same time as positions were unwound. See [Factor Timing, Crowding and Crashes](https://learn.tradelabsai.com/research/factor-crowding/).

## Risk management

1. **Use stop losses on the spread,** such as a z score of 4, or a time limit.
2. **Check that a fundamental reason links the pair.**
3. **Retest the relationship regularly** on recent data.
4. **Trade many pairs** rather than one, which moves towards [Statistical Arbitrage](https://learn.tradelabsai.com/strategies/statistical-arbitrage/).
5. **Watch event risk** such as earnings dates for either stock.

## Testing a pairs strategy

Testing thousands of possible pairs will find some that look cointegrated by chance. Use out of sample periods and correct for multiple testing. Include borrow costs and realistic short availability. See [P-Hacking and Multiple Testing](https://learn.tradelabsai.com/research/p-hacking-and-multiple-testing/) and [In-Sample vs Out-of-Sample Testing](https://learn.tradelabsai.com/research/out-of-sample-testing/).

## Frequently asked questions

### What is pairs trading?

A market neutral strategy that goes long one asset and short a related one when their price relationship stretches, expecting it to return to normal.

### What is the difference between correlation and cointegration in pairs trading?

Correlation measures whether returns move together; cointegration tests whether the price spread stays stable over time, which matters more for pairs trading.

### Is pairs trading risk free?

No. The relationship can break permanently, and short positions carry borrow costs and squeeze risk.

Next, scale the idea to many assets with [Statistical Arbitrage](https://learn.tradelabsai.com/strategies/statistical-arbitrage/).

## Sources

- Gatev, E., Goetzmann, W. and Rouwenhorst, K. G., Pairs Trading: Performance of a Relative Value Arbitrage Rule, Review of Financial Studies, 2006. Summary: [Wikipedia, Pairs trade](https://en.wikipedia.org/wiki/Pairs_trade)

## Continue learning

- Next lesson: [Statistical Arbitrage](https://learn.tradelabsai.com/strategies/statistical-arbitrage/)
- Previous lesson: [Mean Reversion](https://learn.tradelabsai.com/strategies/mean-reversion/)
- Related: [Mean Reversion](https://learn.tradelabsai.com/strategies/mean-reversion/): Mean reversion trades bet that prices stretched far from their average will come back. Learn the signals, z scores, examples and the risk of fading strong trends.
- Related: [Cointegration](https://learn.tradelabsai.com/math/cointegration/): Cointegration means two non stationary series share a long run relationship. Learn the Engle Granger and Johansen tests, hedge ratios and pairs trading uses.
- Related: [Statistical Arbitrage](https://learn.tradelabsai.com/strategies/statistical-arbitrage/): Statistical arbitrage trades many small, mean reverting mispricings across a portfolio of securities. Learn how stat arb works, its models, costs and risks.
- Related: [Percentiles, Quantiles and Z-Scores](https://learn.tradelabsai.com/math/z-scores/): A z score shows how many standard deviations a value is from its mean. Learn the formula, its uses in mean reversion and pairs trading, and the pitfalls.
- Related: [Short Selling](https://learn.tradelabsai.com/markets/short-selling/): Short selling means selling a borrowed asset to profit if its price falls. Learn how shorting works, borrow costs, short squeezes and why the risk is so high.
