yfinance
The Python library everyone starts with — free, unofficial, and not something to build on.
by Ran Aroussi
Last updated
What it is
yfinance is a Python library that pulls price history, fundamentals, options chains and corporate actions from Yahoo Finance's internal endpoints and hands them back as pandas DataFrames. It costs nothing, needs no key, covers most of the world's exchanges, and is almost certainly what the tutorial you are reading uses.
It is also unofficial. There is no agreement behind it, no support, no uptime commitment and no
rate limit you can plan against: neither yfinance's documentation nor Yahoo's API terms publish a
number, and those terms reserve rate limits to Yahoo's "absolute and sole discretion". Every
time Yahoo changes its endpoints, yfinance breaks for everyone simultaneously until a
maintainer ships a fix. What the library does publish is what happens when you cross the invisible
line — a 429 on a data request raises YFRateLimitError, "Too Many Requests. Rate limited. Try
after a while.", while a 429 on the cookie-and-crumb handshake is downgraded to a warning and the
request retried without it. Maintenance is real but volunteer — eight releases between mid-April
and the end of August 2026, the last of them 1.7.0 on 26 August, and the merges behind them are
signed by a community maintainer rather than by the author whose name is on the repo.
That combination makes it excellent for research and a poor foundation for anything with users.
Data & coverage
Global, delayed, and deep on daily bars — the docs state plainly that intraday data cannot extend past the last 60 days. Fundamentals are present and of uneven quality; treat anything surprising as a parsing artefact until a second source agrees. Beyond prices the library also wraps Yahoo's screener (predefined and custom queries), search, sector and industry data, news, and a websocket for streaming quotes — all of it as undocumented and unguaranteed as the rest.
Integrations
pip install yfinance is the whole install, and the dependency list is the interesting part:
curl_cffi for browser-impersonating HTTP, pandas for the frames it hands back, peewee for the
on-disk cookie and timezone cache, websockets and protobuf for the live stream. The one extra
left is repair, which pulls scipy and scikit-learn for the price-repair code; the nospam
extra that older tutorials still install was deleted in August 2026. The similar names on PyPI —
yahoo-finance and yahoofinance — are unrelated packages by other authors.
Caching wrappers are now refused outright. Passing a requests_cache session raises
YFDataException with "Caching sessions (e.g. requests_cache) are not supported", and any session
that is not a curl_cffi or requests Session is rejected the same way, so the standard trick for
softening the rate limit is gone.
A list passed to yf.download is not a batch request. In 1.7.0 it runs Ticker.history once per
symbol, on up to twice as many threads as the machine has CPU cores, and a symbol that fails is
logged as one of "N Failed downloads" and comes back as an empty column rather than an exception.
Downstream, OpenBB dropped it from its own repository in V5 (September 2026);
openbb-yfinance 2.0.0, which requires yfinance>=1.3, is now published separately from its
maintainer's own repository. vectorbt lists it in its full extra. In both
cases the ceiling is Yahoo's, whatever the wrapper's own documentation promises.
Limitations
- No contract, no support, no SLA — by design, not by omission.
- Undocumented throttling. Nothing publishes a quota; you find the ceiling by hitting it and
reading
YFRateLimitError, and the caching sessions people used to blunt it are now refused. - Breaks whenever Yahoo changes an endpoint.
auto_adjust=Falsedoes not mean raw.Closeis still split-adjusted, only not dividend-adjusted, so a script ported onto another vendor's unadjustedclosereads every pre-split price several times too high.- Spin-offs arrive as stock splits. 3M's April 2024 spin-off of Solventum is a 1.196 "split" in yfinance, with the dividend before it restated to match; see split and dividend history as data.
- Personal use only. The project's own README says so, and Yahoo's developer API terms forbid selling, sublicensing or deriving income from the APIs without Yahoo's written permission. The Apache-2.0 licence covers yfinance's code, not the data it returns. Training a model on it is the same question; Can you train a model on licensed market data? reads Yahoo's terms on it.
- It is a library, not an API, and it is catalogued here because that is where people look for it.
Alternatives
If the reason you are considering yfinance is money, the free tiers of Alpha Vantage are smaller but contractual. If it is coverage, the paid providers in the market data category start around $10 a month. The old shortcut of swapping the source in pandas-datareader is gone — 0.11.0 (23 June 2026) removed its Yahoo, Stooq and Tiingo readers — and replacing yfinance in a script covers the adapter that takes its place.
Specs
- Interfaces
- Python, Python
- Export
- CSV, JSON
- Asset classes
- Stocks, ETF, Options, Forex, Crypto, Indices, Mutual funds
- Markets
- US, EU, UK, Asia, Global
- Platforms
- Library
- AI features
- None
- Capabilities
- Screening, News
- Pricing verified
- Capabilities verified
- Coverage verified
Also from Ran Aroussi
Head to head
- Massive vs Alpha Vantage vs yfinance: what the free tiers actually give you — Three free sources of US price history, metered in three different units and adjusted three different ways — and not one of them licensed for a product.
Also worth comparing
- AlgoSeek — Lossless SIP, OPRA and CME tick history with published per-asset-class lease pricing.
- Alpha Vantage — The API most people's first script talks to — free key, wide coverage, hard rate limits.
- CSI Data — End-of-day futures history back to 1922 and eight ways to build a continuous contract.
- Databento — Full order book and tick history from exchange feeds, billed by the gigabyte.
- EODHD — End-of-day and fundamentals for 60+ exchanges worldwide, at a hobbyist price.
- FirstRate Data — Historical US intraday and tick data as zipped CSV, bought once rather than rented.
Named as a replacement for
FAQ
Is yfinance legal to use?
It reads Yahoo Finance's undocumented endpoints. The project's own README says the Yahoo finance API is intended for personal use only, and Yahoo's developer API terms forbid deriving income from the APIs without written permission. Fine for personal research; not something to put under a product you charge for.
Why does yfinance keep breaking?
Because it depends on endpoints Yahoo never promised to keep. When Yahoo changes something, every user breaks at once and waits for a release. Budget for that or use a provider with a contract.
What happens when yfinance gets rate-limited?
Yahoo answers with HTTP 429 and the library raises YFRateLimitError — "Too Many Requests. Rate limited. Try after a while." No quota is published anywhere, and the usual workaround of wrapping calls in a requests_cache session is now refused by yfinance itself.
Is yfinance an API?
No — it is a Python library that fetches from Yahoo over undocumented HTTP endpoints. It sits in the market data category because that is the job it is hired for and where people look for it.