Howwise RSS
Trading Software7 min read

Survivorship Bias Backtest: How to Measure and Fix It

Short answer

Survivorship bias in a backtest happens when your universe contains only securities that exist today, so bankrupt, delisted and acquired names are missing and returns look better. Fix it with point-in-time membership plus delisted price history.

Key takeaways
  • Selecting today's tickers for a historical test is look-ahead bias in universe selection, separate from price look-ahead.
  • Rough published estimates put the inflation around 1 to 4 percent a year for broad equity universes, and more for small caps and long horizons; treat these as ranges, not guarantees.
  • A proper fix needs permanent IDs, a membership table with start and end dates, and delisting returns for names that vanish mid-holding period.
  • Without a clean dataset you can still estimate the bias by comparing against a point-in-time sample, a random-entry placebo and a total-return benchmark.
  • Free sources such as yfinance cannot be fully repaired by scraping; report results as upper bounds.

What is survivorship bias in a backtest and why does it inflate returns?

Survivorship bias is a universe-selection error. If you build the ticker list today and run it over 2005 to 2025, every name in the list is one that survived until today, and usually one that grew. Companies that went bankrupt, were delisted for failing listing standards, or were bought at depressed prices are not there to lose money in your simulation.

It is a form of look-ahead bias, but it is distinct from price look-ahead. Your signals may use only past prices and still be contaminated, because the decision about which names exist in the test used knowledge from the end of the sample.

The classic symptom is a backtest of today's S&P 500 members over 20 years that beats the index. Many current members joined the index after large run-ups, so the test effectively buys them years before they were promoted, while the stocks that were removed along the way are absent.

The effect is largest for long-only strategies, small caps, value and mean-reversion (buying losers that later failed are the missing cases), and high-turnover strategies that repeatedly buy weak names. It inflates return, flatters Sharpe, and understates maximum drawdown because the deepest losses are the names that went to zero.

How much does survivorship bias inflate backtest returns?

Published estimates for broad equity universes are commonly on the order of 1 to 4 percent per year, and larger for small caps, micro caps and long horizons. These are rough ranges from varied studies and depend on period, universe and strategy. Do not subtract a fixed number and call it corrected.

The size depends on how much the universe churned. A large-cap index with low turnover in membership carries less bias than a Russell 2000 or all-listed-stocks universe. Strategies that tilt toward losers or low prices carry more.

FactorBias tends to beWhy
Large-cap index, 5 year windowSmallerFew removals, few bankruptcies
Small or micro caps, 20 year windowLargerHigh failure and delisting rate
Long-only buy-the-dip or valueLargerBuys names that later fail
High turnoverLargerRepeated exposure to the weak names each period
Large-cap momentumModerateLosers fall out of the top ranks before failing, but sample is still tilted
ETFs, futures, FXSmallerFewer deaths, though closed ETFs exist

How do I build a point-in-time universe and handle delistings in pandas?

The core structure is a membership table keyed by a permanent identifier, not a ticker. Each row says that a security was in the universe from start_date to end_date. Tickers get reused (and renamed after mergers), so a ticker-keyed join can attach one company's history to another.

Sources for S&P 500 history: the Wikipedia 'Selected changes' table is a free starting point but is incomplete and maps to current identifiers. Commercial constituent histories exist from Norgate, CRSP, Sharadar, FactSet and Compustat.

At every rebalance, keep only names whose interval contains that date. Then, if a held name disappears before the next rebalance, force an exit at its last price plus a delisting return rather than silently dropping the position.

import pandas as pd

# members: id, start_date, end_date (NaT = still member)
# prices: DataFrame indexed by date, columns = id (adjusted close)
# delist: id, last_date, dlret (delisting return, e.g. -0.30 if unknown/performance)
members['end_date'] = members['end_date'].fillna(pd.Timestamp('2100-01-01'))

def universe_on(d):
    m = members[(members.start_date <= d) & (members.end_date > d)]
    return m['id'].tolist()

def period_return(ids, d0, d1, prices, delist):
    out = {}
    dl = delist.set_index('id')
    for i in ids:
        s = prices[i].loc[d0:d1].dropna()
        if s.empty or d0 not in s.index:
            continue
        r = s.iloc[-1] / s.iloc[0] - 1
        if i in dl.index and d0 < dl.loc[i, 'last_date'] <= d1:
            # exited mid-period: last price, then delisting return
            r = (1 + r) * (1 + dl.loc[i, 'dlret']) - 1
        out[i] = r
    return pd.Series(out)

rebals = pd.date_range('2005-01-31', '2024-12-31', freq='ME')
rets = []
for d0, d1 in zip(rebals[:-1], rebals[1:]):
    ids = universe_on(d0)          # membership as of d0 only
    r = period_return(ids, d0, d1, prices, delist)
    rets.append(r.mean())          # equal weight example
Warning: Use trading-calendar dates that exist in the index; d0 not in s.index silently skips names in the sketch above. Align rebalance dates to actual trading days before running it on real data.

How are delisting returns handled when the data is missing?

Do not just drop the last bar. A stock that trades at 0.40 and then vanishes lost more than the last price shows, because holders often get nothing or a fraction after the final print. CRSP records a delisting return for this reason.

Where a delisting return is missing, a common convention follows Shumway (1997): assume roughly -30 percent for performance-related delistings, and treat bankruptcies and liquidations as a total or near-total loss. Mergers paid in cash or stock should use the deal consideration instead, because acquisitions are often positive events. Run sensitivity from -100 to 0 percent to see how much your result depends on the assumption.

Exit typeTypical treatment
Bankruptcy, liquidationNear -100 percent, or last OTC price if available
Performance delisting (listing standards)About -30 percent if missing, then test sensitivity
Cash acquisitionDeal price versus last close
Stock acquisitionConvert into acquirer shares and continue holding
Index removal onlyNo delisting return; stock still trades

Which data sources include delisted stocks, and what can free data do?

Vendors that carry dead securities include Norgate Data, CRSP, Sharadar (SEP and SF1 via Nasdaq Data Link), EODHD (delisted tickers), Polygon (listings with active=false), Tiingo and Databento reference data. They differ in coverage depth, start date, whether constituent history is included, and whether delisting reasons exist, so verify each against the checklist below.

yfinance and Yahoo-backed free APIs mostly drop delisted tickers, and adjustments for splits and dividends are reliable mainly for survivors. Wikipedia lists are incomplete and map names to current identifiers, so scraping to fill gaps remains partial and still biased. Treat free data as an approximation tool, not a fix.

BudgetApproachLimitation
FreeWikipedia changes plus current-ticker pricesDead names missing; biased upper bound
Low costVendor with delisted prices and constituentsCoverage start dates and reasons vary
InstitutionalCRSP, Compustat, FactSetCost and licensing, ID mapping work
Warning: Key everything on PERMNO, FIGI or CIK, not tickers. A reused ticker can pull a different company's prices into your history.

How can I estimate the bias when I cannot get perfect data?

Quantify before fixing. These diagnostics give a relative estimate, not an exact correction.

  1. Run the strategy on both a point-in-time universe and the current-ticker universe over a short overlapping window where you have clean data, and compare return, Sharpe and max drawdown.
  2. Run the same strategy on a small survivorship-free vendor sample and compare to your free-data result.
  3. Run a placebo: random entries on the current-ticker universe, with no signal. Any positive drift it earns is the free lift from survivors.
  4. Compare against a total-return index ETF or benchmark over the same period; persistent excess return for a naive strategy is a warning.
  5. Haircut results, and report them as upper bounds.
Tip: If stuck with current tickers: shorten the lookback, use a window where the universe changed little, prefer large liquid indexes, apply liquidity and market-cap filters using values as of each date, add random dropouts with a delisting penalty, and cross-check on ETFs, futures or FX where survivorship is smaller.

Which related universe biases should I check, and how do I audit a dataset?

Check fundamentals for restatements and reporting lag (use the filing date, not the period end). Compute market-cap and liquidity filters with values known then, not current ones. Watch IPO and backfill bias, where a vendor adds history for newly listed names only after they succeed. Index inclusion is announced before the effective date, so using the effective date for membership can misrepresent what was knowable.

  1. Confirm the dataset contains dead tickers with full price history.
  2. Count securities per year; the number should be roughly stable or follow real listing counts, not shrink going backward.
  3. Check for delisting dates and reasons.
  4. Confirm permanent identifiers rather than tickers.
  5. Spot-check known bankruptcies and acquisitions, and verify they appear with a final price.

Common questions

Does yfinance have survivorship bias?

Yes for most uses. Yahoo-based data mostly lacks delisted tickers, so a list of tickers pulled from today's index excludes the names that failed. Adjusted prices are also reliable mainly for surviving tickers.

Is survivorship bias the same as look-ahead bias?

It is a type of look-ahead bias, applied to universe selection instead of prices. Your signals can use only past data and the test is still biased, because the list of names was chosen with knowledge of who survived.

Can I fix survivorship bias with Wikipedia S&P 500 changes?

Only partly. The changes table lets you reconstruct approximate membership, but it is incomplete, uses current identifiers, and does not supply price history for removed companies.

Do ETFs and futures have survivorship bias?

Less, but not zero. Closed and merged ETFs exist, and data sets that list only live funds omit them. Futures bias depends on how continuous contracts are built.

Related topics:backtestingsurvivorship biasdata qualitypython