Quick Reference · Yahoo! Finance market data in Python

yfinance cheat sheet

One idea unlocks the whole library: a Ticker object is your single handle to everything Yahoo knows about a symbol — prices, actions, financials, analyst views, options — and each attribute you touch is a lazy HTTPS call that hands back a pandas DataFrame or dict. yf.download() is the bulk shortcut when you only want prices for many symbols at once.

setup & config price history ★core actions & options info & financials analysis & holders discovery & live gotcha / deprecated most common

Distilled & cross-checked against: ranaroussi.github.io/yfinance (official docs + API reference) · github.com/ranaroussi/yfinance · PyPI · AlgoTrading101 · Medium/PythonFinTech guides — verified live against installed yfinance 1.5.1.

The mental model — one object, lazy calls, DataFrames back
YOUR CODE YAHOO · THE CLOUD PANDAS symbol "AAPL" yf.Ticker("AAPL") your handle to ONE symbol .history() .info .fast_info .balance_sheet .dividends .option_chain() .news … attribute access = 1 lazy HTTPS call Yahoo! Finance query1.finance.yahoo.com fetched via curl_cffi (browser impersonation) 429 if you hammer it → JSON DataFrame / dict tidy, indexed by date Open High Low Close Volume Dividends Stock Splits → straight into pandas/plots THE BULK SHORTCUT — prices only, many symbols yf.download([…]) ["AAPL","MSFT","RELIANCE.NS"] threaded · one request round same Yahoo endpoints one MultiIndex DataFrame (field, ticker) columns
 quickstart.py
import yfinance as yf

aapl = yf.Ticker("AAPL")              # one handle to everything
px   = aapl.history(period="6mo")     # OHLCV DataFrame, auto-adjusted
aapl.fast_info["last_price"]           # quick, reliable spot quote
aapl.balance_sheet                     # financial statements (DataFrame)
chain = aapl.option_chain(aapl.options[0])  # .calls / .puts / .underlying

# bulk: many symbols, prices only → MultiIndex columns
data = yf.download(["AAPL", "MSFT", "RELIANCE.NS"],
                 period="1y", interval="1d")
01Setup & Installget going
02The Ticker Objectone handle
03download() · bulk pricesthe workhorse
04.history() · one symbolrichest prices
05period & intervalthe allowed strings
06The Price DataFramereading it
07Corporate Actionsdividends & splits
08Optionsthe chain
09Company Info & Newsthe profile
10Financial Statementsfundamentals
11Analyst Views & Estimatesthe street
12Holders & Insiderswho owns it
13Funds & ETFsfunds_data
14Multiple Tickersat scale
15Search & Lookupfind symbols
16Sector · Industry · Markettop-down
17Screener & Queriesfilter the market
18Live StreamingWebSocket
19Config · Cache · Debugbe a good citizen
Symbol Conventionsdecode any ticker

Four pictures that make it click

The shapes behind the API — what a Ticker fans out into, how download() reshapes columns, the silent auto-adjust default, and how far back each interval reaches.

One Ticker → every dataset

The same object hands back different shapes: DataFrames, Series, dicts. Colours match the cards.

Ticker ("AAPL") .history() DataFrame OHLCV .actions Series .fast_info dict .balance_sheet DataFrame .analyst_price… dict .option_chain() .calls / .puts

download() column shapes

One symbol → flat columns. Many symbols → a two-level MultiIndex, ordered by group_by.

download("AAPL") OpenHighLow CloseVolume download([…], group_by="column") Close Volume AAPLMSFT AAPLMSFT level 0 = field · level 1 = ticker  →  data["Close"]["AAPL"] download([…], group_by="ticker") AAPL MSFT CloseVolume CloseVolume

auto_adjust — the silent default

Since the 0.2 line, auto_adjust=True is the default: OHLC come back already adjusted and there is no Adj Close column unless you opt out.

auto_adjust=True  ·  DEFAULT Openadjusted Highadjusted Lowadjusted Closeadjusted Volume auto_adjust=False  ·  opt out Open High Low Close AdjClose Volume raw prices + the extra dashed column back

How far back each interval reaches

Yahoo caps intraday history. Daily & up go back to the IPO; the finer the bar, the shorter the window.

today 1m 7d 2m–90m, 1h 60d 1d full history → up to "max" 1wk / 1mo full history, coarser bars ← older  ·  bars to the LEFT of the line don't exist for capped intervals

Worth memorizing

auto_adjust = Truenow the DEFAULT — OHLC pre-adjusted, no Adj Close unless you opt out
fast_info ≫ info.info is slow & can break; .fast_info for quick, reliable fields
end is exclusiveend="2024-01-01" stops before Jan 1 — add a day to include it
intraday limits1m → last 7 days · any <1d → last 60 days
429 = throttledYahoo rate-limits — cache, batch, sleep; don't hammer
multi → MultiIndexmany tickers = 2-level columns; multi_level_index=False flattens one
curl_cffi, not requestscustom sessions must come from curl_cffi.requests
bad symbol → emptyreturns an empty DataFrame, not an error (unless raise_errors=True)
.earnings deaddeprecated — read net income from income_stmt
proxy movedper-call proxy= deprecated → yf.set_config(proxy=…)
reuse the objectevery attribute is a live HTTP call — build the Ticker once
India tickers.NS = NSE · .BO = BSE · ^NSEI NIFTY · ^BSESN SENSEX