25,217 stars · Apache-2.0 · 1.7.0 (2026-08-26, ungh; pypi.org is blocked by robots.txt from this sandbox) · Track this in Scout
A Python library that fetches historical prices, dividends, company financial statements and option chains from Yahoo Finance and returns them as pandas dataframes.
▶Repo detailsthe review · specs · pros & cons · install
What it is
yfinance is a Python library that fetches historical prices, dividends, company financial statements and option chains from Yahoo Finance's public endpoints and returns them as pandas dataframes. It handles the request details, caching and rate limiting behind one simple call.
What it is good for. The situation where you want to test an idea about markets and the first obstacle is that every data provider wants a subscription before you have written a line. It is also the quickest way to build a table of prices for a hobby portfolio.
- Free, and it covers shares, indices, currencies, funds and cryptocurrency in one interface.
- The output is a pandas dataframe, so it drops straight into the rest of the Python analysis world with no conversion.
- Very widely used, which means almost every question has been asked and answered somewhere.
- It is not affiliated with Yahoo, and the project says so plainly. Yahoo's terms describe the data as being for personal use, so read them before building anything commercial on top.
- The data source is unofficial and can break. When Yahoo changes something the library stops working until a new version appears, which has happened more than once.
- The history is not clean. Splits, dividends and delisted companies all have edge cases, and a backtest that trusts the raw numbers will flatter itself.
OpenBB-finance/OpenBB73,356 stars, covered in Edition 24; one interface in front of many data sources, of which Yahoo is only one, at the cost of a much bigger install.
Track this in Scout- JerBouma/FinanceToolkit
5,250 stars, focused on calculating financial ratios and performance measures from data you supply rather than on fetching it.
Track this in Scout
nautechsystems/nautilus_traderCovered in Edition 17; a full trading engine rather than a data library, for when fetching prices is no longer the hard part.
Track this in Scout
python3 -m venv venv
source venv/bin/activate
pip install yfinance
python3 -c "import yfinance as yf; print(yf.Ticker('MSFT').history(period='1mo'))"