Files
ai/gateway/knowledge/trading/strategies/stocks/pairs-trading.md
Tim Olson 47471b7700 Expand model tag support: add GLM-5.1, simplify Anthropic IDs, scan tags anywhere in message
- Flink update_bars debouncing
- update_bars subscription idempotency bugfix
- Price decimal correction bugfix of previous commit
- Add GLM-5.1 model tag alongside renamed GLM-5
- Use short Anthropic model IDs (sonnet/haiku/opus) instead of full version strings
- Allow @tags anywhere in message content, not just at start
- Return hasOtherContent flag instead of trimmed rest string
- Only trigger greeting stream when tag has no other content
- Update workspace knowledge base references to platform/workspace and platform/shapes
- Hierarchical knowledge base catalog
- 151 Trading Strategies knowledge base articles
- Shapes knowledge base article
- MutateShapes tool instead of workspace patch
2026-04-28 15:05:15 -04:00

3.3 KiB
Raw Blame History

description, tags
description tags
Identifies pairs of historically correlated stocks and trades the spread by shorting the outperformer and buying the underperformer when a mispricing deviation occurs.
stocks
mean-reversion
pairs-trading
arbitrage

Pairs Trading

Section: 3.8 | Asset Class: Stocks | Type: Mean-Reversion / Statistical Arbitrage

Overview

Pairs trading is a dollar-neutral mean-reversion strategy that identifies two historically highly correlated stocks (stock A and stock B). When a mispricing occurs — a deviation from their high historical correlation — the trader shorts the "rich" stock and buys the "cheap" stock, expecting convergence. This is a classic statistical arbitrage strategy.

Construction / Signal

Let P_A(t_1), P_B(t_1) be prices at entry time and P_A(t_2), P_B(t_2) at a later time. Returns (log approximation preferred for small returns):

R_A = ln(P_A(t_2) / P_A(t_1))                             (285)
R_B = ln(P_B(t_2) / P_B(t_1))                             (286)

Mean return and demeaned returns:

R_bar = (1/2) * (R_A + R_B)                               (287)
R_tilde_A = R_A - R_bar                                   (288)
R_tilde_B = R_B - R_bar                                   (289)

A stock is "rich" if its demeaned return R_tilde > 0, and "cheap" if R_tilde < 0.

Dollar-neutrality constraints for share quantities Q_A, Q_B (at time t_*):

P_A |Q_A| + P_B |Q_B| = I                                 (290)
P_A Q_A + P_B Q_B = 0                                     (291)

where I is the total desired dollar investment.

Entry / Exit Rules

  • Entry: When the spread between the two stocks deviates significantly from its historical mean (mispricing), short the rich stock (positive demeaned return) and buy the cheap stock (negative demeaned return). Satisfy dollar-neutrality via Eqs. (290)-(291).
  • Exit: Close positions when the spread converges back to historical norm, or at a predefined stop-loss if the spread widens further.
  • Pair selection: Choose pairs with historically high correlation (e.g., same sector/industry).

Key Parameters

  • Pair selection criterion: Historical correlation coefficient (typically over 612 months)
  • Entry threshold: Deviation from historical spread mean (typically z-score of spread)
  • Exit threshold: Convergence back toward mean, or stop-loss if spread widens beyond limit
  • Total investment I: Split equally between long and short legs

Variations

  • Multi-stock generalization: See Section 3.9 (Mean-reversion — single cluster) for N > 2 stocks
  • Cointegration-based pairs: Use cointegration tests (Engle-Granger) instead of correlation to identify pairs
  • Distance method: Sort all possible pairs by sum-of-squared-differences of normalized price series

Notes

  • Pairs trading is dollar-neutral by construction, removing market beta exposure.
  • Risk: if the pair "breaks" (fundamental divergence rather than temporary mispricing), the trade can lose indefinitely — this is a key risk with no natural stop other than a manual stop-loss.
  • Prices should be fully adjusted for splits and dividends.
  • The log-return approximation (Eqs. 285-286) is preferred over simple returns (Eqs. 283-284) as it is more accurate for small returns.
  • Typical holding period: short-term (days to weeks) until spread convergence.