Financial Literature

Community (unofficial Yahoo Finance)

yfinance — The notebook favourite: one line for a ticker's history or option chain — unofficial, throttled, and not for jobs

In a notebook, for a quick look: a ticker's history, its option chain, a few fundamentals — where being throttled or broken next week is an inconvenience, not an incident.

equitiesoptionsfxcryptoindicesglobal
Asset classesequities · options · fx · crypto · indices
Frequencyintraday → monthly
Historyvaries → today
Limit · costNo key · Yahoo throttles (429) aggressively; no service level
KeyNo key
Formats · pull withpython — python
LicenceYahoo's terms prohibit automated and commercial use of its data; yfinance is a community scraper with no licence to grant. A notebook, not a product.
RedistributeNo — link and pull, do not republish
Best for“A quick look at one ticker, option chain included” · “Prototyping before you choose a licensed source”
When to use it

Reach for it when…

In a notebook, for a quick look: a ticker's history, its option chain, a few fundamentals — where being throttled or broken next week is an inconvenience, not an incident.

Not for: Anything unattended or repeated (it 429s within minutes from a bare loop and breaks whenever Yahoo changes a page), anything commercial, anything you will redistribute.

How to read it

Units, revisions, traps

Units. Prices in the listing currency; 'Adj Close' includes dividends and splits. Intervals below daily are limited to recent history (1-minute: 7 days).

Revisions. Whatever Yahoo shows today.

  • Bare loops get 429 Too Many Requests; use requests_cache and a delay, and expect it to break.
  • The library's column names and behaviour change between versions (auto_adjust default flipped in 2025).
  • Symbols are Yahoo's: 005930.KS for Samsung, ^KS11 for the KOSPI.

Classic mistake: Scheduling a daily job on yfinance and discovering a month of gaps.

How to use it in your own work

Three recipes

Each recipe: Python · Excel · Sheets, with how to read the result. Python recipes run under pandas; recipe 1 is re-run by the weekly check where the source allows it.

How to use it in your own work

Copy the snippet, change the series id, read the result the way the footer says. Replace YOUR_…_KEY with your own key where one is needed.

Recipe 1One ticker's history

# pip install yfinance requests_cache
import yfinance as yf
import requests_cache
session = requests_cache.CachedSession("yf.cache", expire_after=3600)
df = yf.download("AAPL", period="1y", auto_adjust=True, session=session, progress=False)
print(df.tail())
How to read the resultauto_adjust=True folds dividends and splits into Close; check the flag before comparing with another source.

Recipe 2An option chain

import yfinance as yf
t = yf.Ticker("AAPL")
exp = t.options[0]
chain = t.option_chain(exp)
print(exp); print(chain.calls[["strike", "lastPrice", "impliedVolatility", "openInterest"]].head())
How to read the resultImplied volatility is Yahoo's own calculation from the last price; stale strikes show absurd values.

Recipe 3What to use instead for a job

# the same daily bars from a source with terms: Twelve Data (free tier) — see its card
import requests, pandas as pd
u = "https://api.twelvedata.com/time_series?symbol=AAPL&interval=1day&outputsize=30&apikey=demo"
df = pd.DataFrame(requests.get(u, timeout=30).json()["values"]).set_index("datetime").astype(float).sort_index()
print(df.tail())
How to read the resultSame numbers, a licence and a rate limit you can plan for.

Series → question map

The ids we use from yfinance, each with the question it answers. The catalog's compare view reads the concept tags behind these rows.

SeriesAnswersRegionConcept
download(ticker)A ticker's daily historyglobalohlc_daily
Ticker.option_chainAn option chain by expiryUnited Statesoptions
download(^KS11)An index quicklyglobalequity_index
Ticker.infoA few fundamentals quicklyglobalfundamentals

Compare with

Same question, different source: Twelve Data, Stooq, Polygon.io. The compare view lines up coverage, frequency, history and access side by side and lists what the combination makes possible.

Open compare: yfinance · Twelve Data · Stooq →

Questions readers ask

Is yfinance legal?

It is a scraper of Yahoo's pages and endpoints; Yahoo's terms forbid automated use. Fine for personal exploration, not for anything commercial or redistributed.

Why does it stop working?

Yahoo changes endpoints and throttles; the library catches up in a release or two. That is the deal.

What should a job use instead?

A source with terms: Twelve Data, EODHD, Polygon, Tiingo for prices; FRED and central banks for macro.

Educational only — we explain, we never advise · snippet licence: public domain · corrections to [email protected], fixed within a day and logged in the changelog.