Skip to content

Does pairs trading survive costs and a sealed test?

Distance and cointegration pairs on large US stocks, with multiple-testing control, realistic trading costs and an out-of-sample test sealed until the rules were frozen, then run once. Neither strategy covers its costs.

By Mizan Nurani

Data as of October 23, 2026

Built with Python, pandas, statsmodels

The protocol

  1. 1

    Fix the split

    2015 to 2021 for design. From January 1, 2022 the data are sealed: the loader refuses to return them.

  2. 2

    Register the rules

    Selection, entry, exit, stop, sizing and costs written down before any P&L was computed.

  3. 3

    Design

    Selection statistics, gross and net results, and a sensitivity grid: 40 configurations, all logged.

  4. 4

    Freeze

    Specification and price file fingerprinted on October 26, 2026, 09:47 UTC.sha256 6888cc1ca8304c7f

  5. 5

    Run once

    Unsealed and run on October 26, 2026, 09:50 UTC, logged as run 1 against the fingerprint. A second run is refused.

The question

Pairs trading buys one stock and shorts another that usually moves with it, betting that a gap between them will close. Gatev, Goetzmann and Rouwenhorst (2006) found it profitable in US stocks for decades. The question here is whether anything is left in liquid large caps today, once trading costs are paid and the result is judged on data the rules never saw.

Method

The universe is 80 large US stocks in four sectors where pairs have an economic link: banks, energy, utilities and consumer staples. Pairs are formed only within a sector, which keeps every candidate plausible and the number of tests down, to at most 687 per window. Pairs are chosen on 12 months of prices and traded for the next 6, then chosen again; every hedge ratio, mean and standard deviation comes from the formation window only.

Two selection rules were registered in advance, each picking 20 pairs per window:

  • Distance, the main strategy: the pairs whose prices, normalized to the start of the window, stay closest together (the smallest sum of squared differences). It makes no claim of statistical significance and is judged out of sample.
  • Cointegration, the variant: the lowest Engle-Granger p-values, with a half-life of 2 to 60 trading days and a hedge ratio of 0.2 to 5, and no multiple-testing correction. The test runs in both directions and keeps the worse p-value, so a pair must look cointegrated whichever stock is the dependent variable.

The spread is the gap between normalized prices for distance pairs, or the cointegrating residual:

st=YtY0−XtX0orst=ln⁡Yt−βln⁡Xt−α,zt=st−μσs_t = \frac{Y_t}{Y_0} - \frac{X_t}{X_0}\quad\text{or}\quad s_t = \ln Y_t - \beta \ln X_t - \alpha,\qquad z_t = \frac{s_t - \mu}{\sigma}

A position opens when ∣zt∣|z_t| reaches 2σ, on the signal at one close and the fill at the next. Distance trades close when the spread crosses back; cointegration trades close within 0.5σ. A move to 4σ against the position stops it out and disables the pair for the rest of the period, and nothing is held more than 63 trading days. Each pair gets an equal slot of capital, 1/20 of the book, split between the legs in the ratio one to the hedge ratio. Every fill pays 2 bp of half-spread, 3 bp of slippage and $0.005 a share; the short leg pays 0.5% a year to borrow. Returns are in excess of cash, since the collateral would earn interest that is not added.

Selection: no discoveries that survive

About 32 of the roughly 680 pairs in each window pass the cointegration test at 5% in both directions (Exhibit 1). A test run that many times will pass some pairs by luck alone, so the count says little by itself. Benjamini-Hochberg controls the false discovery rate across all of a window’s tests; after it, 11 of the 14 windows keep no pair at all, and none keeps more than 3. That is why the main strategy uses the distance method and makes no significance claim, and why the cointegration variant, which takes the lowest p-values without the correction, was registered as a comparison.

Exhibit 1Cointegration tests, window by window

Within-sector pairs passing an Engle-Granger test at 5% in both directions, and those still significant after Benjamini-Hochberg

  • p below 5% both ways
  • Significant after Benjamini-Hochberg

Mizan Nurani, pairs-trading (results committed in the repository). Author’s calculations.

Design period: a small edge, gone after costs

From 2015 to 2021, the distance rules earned a gross Sharpe ratio of 0.32, a t-statistic of 0.85, which is not significant. After costs it was −0.10. Per trade that is +12.0 bp before costs and −3.7 bp after, in basis points of the pair’s slot (Exhibit 2). Trades that converge make about +259 bp, but stop-outs outnumber them, 161 to 96, at about −148 bp each (Exhibit 3): pairs break more often than they revert.

Exhibit 2Design period, before and after costs

2015 to 2021, the registered rules

MeasureDistanceCointegration
Gross Sharpe ratio (t)0.32 (0.85)0.14 (0.38)
Net Sharpe ratio−0.10−0.21
Net return a year−0.09%−0.27%
Trades a year4858
Winners after costs41%50%
Average holding, days2722

Mizan Nurani, pairs-trading (results/design_metrics.csv). Author’s calculations.

Exhibit 3Pairs break more often than they converge

Design period: average gross P&L per trade by how the trade ended, in basis points of the pair’s capital

  • Distance
  • Cointegration

Mizan Nurani, pairs-trading (results committed in the repository). Author’s calculations.

How one trade is booked

The accounting is checked by hand in the repository’s tests. Exhibit 4 runs that case through this page’s port of the engine at the frozen sizing, a $500,000 slot. The spread opens 3 standard deviations wide on day 1, so the trade fills at day 2’s close; it is back at zero on day 4 and closes on day 5. The four fills (two legs, in and out) and the borrow fee cost $560, 11.2 bp of the slot. Across the design period’s distance trades, costs averaged 15.7 bp against a gross edge of 12.0 bp.

Exhibit 4One round trip, day by day

Short the spread at a z-score of 3, normalized prices, one standard deviation of 1%. Fills come the day after the signal.

DayYXzWanted at closeHeld after closeGrossCostsBorrowNet
01001000.0flat
11031003.0short
21031003.0shortshort−$275−$275
31011001.0shortshort$4,854−$5$4,850
41001000.0flatshort$2,427−$5$2,422
51001000.0flat−$271−$5−$276
61001000.0flat
71001000.0flat
Round trip$7,282−$546−$14$6,721

The test case in pairs-trading’s tests/test_engine.py, run on this page’s TypeScript port of the engine.

Sensitivity is a diagnostic

The grid in Exhibit 5 re-runs the design period at four entry thresholds and five cost levels. The net Sharpe ratio falls steadily as costs rise, and at the frozen cost of 5 bp only one cell is positive: distance at 3σ, with a net Sharpe ratio of 0.31. It was not adopted. Its profit comes from a single year, 2020, and the other years together lose money; and picking a cell after seeing the grid would turn the check into a search for the best-looking result. The frozen rules are the registered 2σ ones.

Exhibit 5Sensitivity is a diagnostic, not a menu

Design-period net Sharpe ratio by entry threshold and trading cost (half-spread plus slippage per leg per fill). The outlined cell is the frozen rule.

Selection

Entry / Cost0 bp2.5 bp5 bp10 bp20 bp
1.5σ0.380.07−0.08−0.38−0.97
2σ0.320.04−0.10−0.37−0.90
2.5σ0.310.05−0.08−0.34−0.85
3σ0.710.450.310.04−0.50

Mizan Nurani, pairs-trading (results committed in the repository). Author’s calculations.

Out of sample: the edge disappears

The holdout, 2022 to October 23, 2026, was unsealed once and run against specification 6888cc1c. The gross edge fell by about 79%, from a Sharpe ratio of 0.32 to 0.07, and neither strategy covers its costs: net Sharpe ratios of −0.28 for distance and −0.28 for cointegration (Exhibits 6 and 7). That is consistent with the literature: Gatev, Goetzmann and Rouwenhorst found pairs profits weakening in later subperiods, and in liquid large caps whatever mean reversion remains is smaller than the cost of trading it. Exhibit 8 has every one of the 526 holdout trades.

Exhibit 6Design against the sealed holdout

Design 2015 to 2021; holdout 2022 to October 23, 2026

MeasureDistance, designDistance, holdoutCointegration, designCointegration, holdout
Gross Sharpe ratio (t)0.32 (0.85)0.07 (0.15)0.14 (0.38)0.03 (0.07)
Net Sharpe ratio−0.10−0.28−0.21−0.28
Net return a year−0.09%−0.30%−0.27%−0.38%
Trades a year48515859
Winners after costs41%49%50%49%
Average holding, days27302222
Stopped out, share of trades48%37%41%42%

Mizan Nurani, pairs-trading (results/holdout_vs_design.csv, run 1). Author’s calculations.

Exhibit 7The holdout, six months at a time

Net return on capital in each trading period of the sealed test

  • Distance
  • Cointegration

Mizan Nurani, pairs-trading (results committed in the repository). Author’s calculations.

Exhibit 8Every trade the sealed test made

Cumulative P&L on the strategy’s capital, booked when each trade closes. Filter by selection rule and sector.

Selection

Sector

Trades
244
Winners after costs
49%
Average trade, after costs
−11.9 bp
Total, on capital
−1.46%
Stopped out
90, −248 bp each
  • After costs
  • Before costs

Mizan Nurani, pairs-trading (results committed in the repository). Author’s calculations.

How it is checked

  • P&L accounting. A hand-computed round trip checks the gross P&L, all four fill costs and the borrow fee to the cent (Exhibit 4).
  • No look-ahead. Fills come the day after the signal, and changing prices after a given day leaves every position and P&L up to that day unchanged.
  • Selection sees the formation window only. Shocking the trading-period prices does not change which pairs are chosen.
  • The test on synthetic data. Independent random walks rarely pass, a planted cointegrated pair is found with its hedge ratio and half-life, and Benjamini-Hochberg rejects almost nothing when nothing is there.
  • The holdout lock. The loader never returns sealed dates, unsealing needs a frozen specification, editing that specification afterwards is detected, and a second run is refused (a forced one would be logged). The record on this page is checked against its own fingerprint when it is imported.

Limitations

  • Survivorship bias. The universe is a list of today’s companies. Firms acquired or failed before 2026 are missing, and survivors are less likely to have diverged for good, so this probably flatters the strategy, which only strengthens the negative result.
  • Ticker changes. Bank of New York Mellon trades as BNY, formerly BK; a stale symbol would have dropped a live company without a trace.
  • Costs are a model, not measured spreads per stock, though the grid shows the result is negative at any realistic level.
  • Daily closes only, with no intraday execution or market impact.
  • Equal-weight slots leave much of the capital idle. A fully invested version would scale returns and risk but not the Sharpe ratio.

Next steps

  • Re-estimating hedge ratios through the trading period, with rolling regressions or a Kalman filter.
  • A wider universe with point-in-time membership, to remove the survivorship bias.
  • Pairs with a mechanical link, such as share classes or an ETF against its basket, where cointegration is structural rather than statistical.

Results from Mizan Nurani’s pairs-trading (commit 2f11980, October 30, 2026). Prices are split- and dividend-adjusted daily closes from Yahoo Finance, not redistributed here. This is a study, not a recommendation.