Details
Where the bias comes from
Survivorship bias appears whenever the list of stocks you test on is chosen with knowledge of the future. The two common forms:
- Missing delisted stocks. Many free data sources only carry symbols that trade today. A company that went bankrupt in 2015 simply isn't there, so its final collapse never hits your backtest.
- Using today's index membership for the past. A stock added to the S&P 500 in 2022 usually got there by rising a lot. Including it in a 2015 universe gives your strategy a stock you could not have known to pick.
Both errors push results the same way: up.
Worked example (illustrative numbers)
Say you test "buy the 50 cheapest stocks by price-to-book in the index, rebalance yearly" from 2010.
- On today's members only, the cheap stocks you buy are ones that later recovered (that is how they stayed in the index). The backtest returns, for example, 14% a year.
- On the point-in-time membership with delisted stocks included, the cheap stocks include several that kept falling and were removed or went to zero. The same rule returns, for example, 8% a year.
Cheap-stock and mean-reversion strategies suffer most, because "cheap and falling" is exactly how companies look on the way to delisting. Momentum strategies are affected too, but usually less.
Code
Build a point-in-time universe in Python
You need two things: daily bars that include delisted symbols, and a membership table with symbol, index_code, start_date and end_date (our STK-SURVIVORSHIP schema).
"""Example: point-in-time index universe for each rebalance date."""
import pandas as pd
members = pd.read_csv("index_membership.csv", parse_dates=["start_date", "end_date"])
members = members[members["index_code"] == "SPX"]
members["end_date"] = members["end_date"].fillna(pd.Timestamp("2100-01-01"))
bars = pd.read_csv("daily_bars_with_delisted.csv", parse_dates=["date"])
def universe(on_date):
m = members[(members["start_date"] <= on_date) & (members["end_date"] > on_date)]
return set(m["symbol"])
rebalance_dates = pd.date_range("2010-01-01", "2025-12-31", freq="BYS")
for d in rebalance_dates[:3]:
u = universe(d)
have = bars[(bars["date"] == bars.loc[bars["date"] >= d, "date"].min())
& bars["symbol"].isin(u)]
print(d.date(), "members:", len(u), "with bars:", have["symbol"].nunique())
The member count should be close to 500 on every date. "With bars" should match it. If it is much lower, your bar data is missing delisted or renamed stocks, and the backtest will still be biased even with a correct membership list. Watch for ticker changes too: a stock that changed symbol needs a stable ID (our permanent_id) to join its old and new bars.
Watch out
Common mistakes
Assuming a big vendor means complete history. Many well-known sources drop delisted symbols. Check by asking for a company you know went bankrupt.
Dropping the final return of a delisted stock. If a stock delists after a bankruptcy, its last move can be -90% or worse. If your code drops the stock the day before, you never take that loss. Use delist_reason to decide how to close the position.
Reusing a ticker. Symbols get recycled. A ticker that belonged to one company in 2008 can belong to another today. Join on a permanent ID, not the symbol.
Fixing membership but not the data filters. A filter like "price above $5 today" is also look-ahead. Apply every filter on data available as of the rebalance date.
Details
Get the data
Delisted stocks and index membership history in one file. What you'll get: daily and 1-minute bars for delisted US stocks, plus membership history with
start_date,end_date,delist_reason,successor_symbolandpermanent_id.
- Survivorship-bias-free stock data, available in early access. Suggested price: $299 one-off. Delisted symbols in API bar endpoints are planned from Pro ($79/mo).
- A free sample file is available on request.
FAQ
Frequently asked questions
What is survivorship bias in backtesting?
It is the error of testing a strategy only on stocks that still exist or are in an index today. Companies that failed or were removed are left out, so the backtest avoids their losses and shows better returns than were really possible.
How much does survivorship bias affect returns?
It depends on the strategy and period. Strategies that buy cheap or falling stocks are hit hardest, because those are the stocks most likely to delist. The gap can be large enough to turn a losing strategy into a winning one on paper.
How do I avoid survivorship bias?
Use price data that includes delisted stocks and a point-in-time index membership history. On each rebalance date, select stocks only from the members as of that date, using only information available then.
Does survivorship bias affect ETFs and crypto?
Yes. ETFs close and crypto assets get delisted from exchanges or go to near zero. Any universe built from what trades today has the same problem.
Keep reading