How to obtain yahoo finance ticker data for stocks that are no longer listed (etc. merge, bankruptcy, etc.)?
How to obtain yahoo finance ticker data for stocks that are no longer listed (etc. merge, bankruptcy, etc.)?
Loading saved threads...
Rocky the Owl · External communityPost link
External question — Quantitative Finance Stack Exchange
Author: Rocky the Owl
Original post: https://quant.stackexchange.com/questions/69363
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am trying to use the Python library
yfinance
to obtain stock data for some companies on a list provided to me (just a fairly generic list). However, amongst this list are companies which are no longer listed on the exchanges for a variety of reasons (e.g. bankruptcy, merged, etc.).
Question
: How can I obtain the stock price data for these companies during an earlier time period? One earlier post () suggests that I would need to pay to get the data for securities which are no longer listed - is this still true?
Some examples are:
Lehman Brothers (the former bank)
Yahoo
United Technologies (merged with Raytheon)
and a few others
Attempt
:
My current use of the module uses the following code (for use within a Google Colab environment):
import pandas as pd
import numpy as np
# pip install yfinance
!pip install yfinance
import yfinance as yf
start_date_string = "2006-01-01" # some made up dates
end_date_string = "2006-12-31"
d = yf.download("[insert string of the ticker]", start=start_date_string, end=end_date_string)
However, the tickers for some of these companies don't work so I don't know how to get that data.
Quote
Report
s teve · External communityPost link
External answer — Quantitative Finance Stack Exchange
Author: s teve
Original post: https://quant.stackexchange.com/a/85855
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Yahoo Finance, and therefore
yfinance
, generally does
not
serve usable OHLCV for names that are gone, including bankruptcies, acquisitions, and ticker retirements. That is a data coverage limitation of the source, not something a different
yf.download
calling convention can fix. Comments on this question already note the same issue with commercial vendors.
What that means for your examples (Lehman, pre-merger UTX, etc.):
You cannot recover those series from Yahoo.
Empty frames or "symbol may be delisted" messages are expected.
Any universe built only from today's Yahoo tickers is survivors-only.
Over long windows that bias is large. Strategies that look great on survivors often fail once dead names are restored.
Paid or curated archives
(CRSP via WRDS, Norgate, Algoseek, etc.) keep point-in-time history with proper identifiers. University finance departments sometimes have WRDS access for students, so it is worth asking before paying personally.
If you need something downloadable for Python without a WRDS seat, look for vendors that ship
day-partitioned files that still contain symbols on their last trading day
, rather than live Yahoo scrapes. I maintain one such Parquet archive (US stocks, ETFs, and futures, split-adjusted, with delisted symbols retained). Overview:
Delisted stock data for survivorship-bias-free backtesting
. Disclosure: I am the founder.
Practical workflow regardless of vendor:
Prefer a
permanent ID
(FIGI, CIK, or an internal ID) mapped to the ticker as of each date. Do not base research on today's ticker string alone, since names can change like UTX to RTX.
Build the universe from
as-of listing membership
, then join prices. Do not start from
yf.Tickers(sp500_today)
.
Keep
raw files immutable
so reruns do not drift.
Quote
Report
Post Reply
Checking account access…