name: yfinance
description: "Yahoo Finance market data downloader. Stock prices, options chains, fundamentals, dividends, splits, earnings, institutional holders, and financial statements. Quick data ingestion for quant research and backtesting."
tags: [yahoo-finance, market-data, stocks, etfs, financial-data, api, zorai]
Overview
yfinance downloads Yahoo Finance market data: stock prices, options chains, fundamentals, dividends, splits, earnings, institutional holders, and financial statements. The fastest path from ticker symbol to pandas DataFrame for quant research and backtesting.
Installation
uv pip install yfinance
Price History
import yfinance as yf
msft = yf.download("MSFT", start="2024-01-01", end="2024-12-31")
print(msft.head())
Fundamentals & Financials
ticker = yf.Ticker("AAPL")
info = ticker.info
print(f"Market cap: {info['marketCap']:,}")
print(f"PE ratio: {info['trailingPE']}")
print(f"Dividend yield: {info.get('dividendYield', 0)*100:.2f}%")
print(ticker.balance_sheet)
print(ticker.financials)
Options
opt = ticker.option_chain(ticker.options[0])
print(opt.calls[["strike", "lastPrice", "impliedVolatility", "volume"]].head())
print(opt.puts[["strike", "lastPrice", "impliedVolatility", "volume"]].head())
References
1---2name: zorai-yfinance3description: "<!-- source: zorai-yfinance — https://raw.githubusercontent.com/mkurman/zorai/main/skills/scientific-skills/yfinance/SKILL.md -->"4---5<!-- source: zorai-yfinance — https://raw.githubusercontent.com/mkurman/zorai/main/skills/scientific-skills/yfinance/SKILL.md -->6---7name: yfinance8description: "Yahoo Finance market data downloader. Stock prices, options chains, fundamentals, dividends, splits, earnings, institutional holders, and financial statements. Quick data ingestion for quant research and backtesting."9tags: [yahoo-finance, market-data, stocks, etfs, financial-data, api, zorai]10---11## Overview1213yfinance downloads Yahoo Finance market data: stock prices, options chains, fundamentals, dividends, splits, earnings, institutional holders, and financial statements. The fastest path from ticker symbol to pandas DataFrame for quant research and backtesting.1415## Installation1617```bash18uv pip install yfinance19```2021## Price History2223```python24import yfinance as yf2526msft = yf.download("MSFT", start="2024-01-01", end="2024-12-31")27print(msft.head())28```2930## Fundamentals & Financials3132```python33ticker = yf.Ticker("AAPL")34info = ticker.info35print(f"Market cap: {info['marketCap']:,}")36print(f"PE ratio: {info['trailingPE']}")37print(f"Dividend yield: {info.get('dividendYield', 0)*100:.2f}%")38print(ticker.balance_sheet)39print(ticker.financials)40```4142## Options4344```python45opt = ticker.option_chain(ticker.options[0])46print(opt.calls[["strike", "lastPrice", "impliedVolatility", "volume"]].head())47print(opt.puts[["strike", "lastPrice", "impliedVolatility", "volume"]].head())48```4950## References51- [yfinance GitHub](https://github.com/ranaroussi/yfinance)