A command-line interface for Yahoo! Finance data, powered by yfinance and Click.
yf gives you instant access to stock quotes, historical prices, financial statements,
analyst ratings, options chains, market screeners, and more — all from your terminal.
- Python 3.13+
- uv (recommended package manager)
git clone <repo-url>
cd yf_cli
uv venv
source .venv/bin/activate
uv pip install -e .Verify:
yf --version
yf --help# bash — add to ~/.bashrc
eval "$(_YF_COMPLETE=bash_source yf)"
# zsh — add to ~/.zshrc
eval "$(_YF_COMPLETE=zsh_source yf)"
# fish — add to ~/.config/fish/completions/yf.fish
_YF_COMPLETE=fish_source yf | sourceOr run yf completion to print instructions for all shells.
yf quote AAPL
yf quote AAPL MSFT GOOGL TSLA NVDA
yf quote AAPL --output jsonyf history AAPL # 1 month, daily (default)
yf history AAPL --period 6mo --interval 1wk
yf history AAPL --start 2024-01-01 --end 2024-12-31
yf history AAPL --period 1y --output csv > aapl.csv
# Periods: 1d 5d 1mo 3mo 6mo 1y 2y 5y 10y ytd max
# Intervals: 1m 2m 5m 15m 30m 60m 90m 1h 1d 5d 1wk 1mo 3moyf info AAPL
yf info TSLA --output jsonyf financials AAPL # annual income statement
yf financials AAPL --type balance --freq quarterly
yf financials AAPL --type cashflow --freq ttm --output json
# --type: income (default) | balance | cashflow
# --freq: annual (default) | quarterly | ttmyf dividends KO
yf splits AAPL
yf actions AAPL --output csvyf analyst AAPL # price targets (default)
yf analyst AAPL --type recommendations
yf analyst AAPL --type upgrades
yf analyst AAPL --type estimates --output json
# --type: targets (default) | recommendations | upgrades | estimatesyf holders AAPL # major holders (default)
yf holders MSFT --type institutional
yf holders TSLA --type insider --output csv
# --type: major (default) | institutional | mutualfund | insideryf calendar AAPL
yf calendar MSFT --output jsonyf options AAPL # list expiry dates
yf options AAPL --expiry 2026-06-18 # calls + puts (default)
yf options AAPL --expiry 2026-06-18 --type calls
yf options AAPL --expiry 2026-06-18 --output csv
# --type: both (default) | calls | puts
# ITM rows are highlighted in greenyf search "electric vehicles"
yf search AAPL --type news --limit 5
yf search "semiconductor" --type quotes --output json
# --type: both (default) | quotes | newsyf screen --list # show available presets
yf screen --preset day-gainers
yf screen --preset most-active --limit 10
yf screen --preset undervalued-growth --output jsonAvailable presets: day-gainers day-losers most-active most-shorted
aggressive-small-caps small-cap-gainers growth-tech undervalued-growth
undervalued-large-caps conservative-foreign-funds high-yield-bond
portfolio-anchors solid-large-growth-funds solid-midcap-growth-funds
top-mutual-funds top-etfs-us top-performing-etfs technology-etfs bond-etfs
yf market # US market status
yf market --list # available sectors
yf market --sector technology
yf market --sector energy --top etfs
yf market --sector healthcare --output json
# --top: companies (default) | etfs | mutual-fundsAvailable sectors: basic-materials communication-services consumer-cyclical
consumer-defensive energy financial-services healthcare industrials
real-estate technology utilities
yf news AAPL
yf news NVDA --limit 5
yf news TSLA --verbose # full summaries + URLs
yf news MSFT --output jsonyf completion # instructions for all shells
yf completion bash
yf completion zsh
yf completion fish--no-color Disable Rich colour output
--version Show version and exit
--help Show help for any command
# Morning market check
yf quote AAPL MSFT GOOGL AMZN NVDA
yf screen --preset day-gainers --limit 10
# Deep-dive a stock
yf info NVDA
yf financials NVDA --type income --freq quarterly
yf analyst NVDA --type recommendations
yf holders NVDA --type institutional
# Options flow
yf options SPY
yf options SPY --expiry 2026-06-18 --type calls
# Export for spreadsheet / analysis
yf history AAPL --period 5y --output csv > aapl_5y.csv
yf financials AAPL --type balance --output json > aapl_balance.json
yf holders MSFT --type institutional --output csv > msft_holders.csvsource .venv/bin/activate
make install # install with dev dependencies
make lint # ruff check
make test # pytest
make test-cov # pytest with coverage report
# End-to-end smoke test (hits live Yahoo Finance API)
bash scripts/smoke_test.shMIT