A CLI for Yahoo! Finance data powered by yfinance and Click
Project description
yf CLI
A command-line interface for Yahoo! Finance data, powered by yfinance and Click.
Overview
yf gives you instant access to stock quotes, historical prices, financial statements,
analyst ratings, options chains, market screeners, and more — all from your terminal.
Requirements
- Python 3.13+
- uv (recommended package manager)
Installation
git clone <repo-url>
cd yf_cli
uv venv
source .venv/bin/activate
uv pip install -e .
Verify:
yf --version
yf --help
Shell Completion
# 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 | source
Or run yf completion to print instructions for all shells.
Commands
yf quote — Real-time quotes
yf quote AAPL
yf quote AAPL MSFT GOOGL TSLA NVDA
yf quote AAPL --output json
yf history — Historical OHLCV prices
yf 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 3mo
yf info — Company overview
yf info AAPL
yf info TSLA --output json
yf financials — Financial statements
yf 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 | ttm
yf dividends / yf splits / yf actions
yf dividends KO
yf splits AAPL
yf actions AAPL --output csv
yf analyst — Analyst data
yf 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 | estimates
yf holders — Ownership data
yf holders AAPL # major holders (default)
yf holders MSFT --type institutional
yf holders TSLA --type insider --output csv
# --type: major (default) | institutional | mutualfund | insider
yf calendar — Earnings calendar
yf calendar AAPL
yf calendar MSFT --output json
yf options — Options chains
yf 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 green
yf search — Search tickers and news
yf search "electric vehicles"
yf search AAPL --type news --limit 5
yf search "semiconductor" --type quotes --output json
# --type: both (default) | quotes | news
yf screen — Market screener
yf screen --list # show available presets
yf screen --preset day-gainers
yf screen --preset most-active --limit 10
yf screen --preset undervalued-growth --output json
Available 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 — Market overview & sectors
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-funds
Available sectors: basic-materials communication-services consumer-cyclical
consumer-defensive energy financial-services healthcare industrials
real-estate technology utilities
yf news — Latest news
yf news AAPL
yf news NVDA --limit 5
yf news TSLA --verbose # full summaries + URLs
yf news MSFT --output json
yf completion — Shell completion setup
yf completion # instructions for all shells
yf completion bash
yf completion zsh
yf completion fish
Global Options
--no-color Disable Rich colour output
--version Show version and exit
--help Show help for any command
Practical Examples
# 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.csv
Development
source .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.sh
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yf_cli-0.2.0.tar.gz.
File metadata
- Download URL: yf_cli-0.2.0.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5b254da510de5a588a51b26563c26baef9decfb84f240e414edcf6c994c1371
|
|
| MD5 |
9a75c4b87f2a13d782857bcb9f3216a0
|
|
| BLAKE2b-256 |
6b9e3bfccef8929cc6fd7843ad08aca7e9d32c35e8dce5bc7c3fe2b5442bd081
|
File details
Details for the file yf_cli-0.2.0-py3-none-any.whl.
File metadata
- Download URL: yf_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce50c64b23d917f9c56caaf2a3bce4b06b1b70c94492b6af75a5df275d4915ff
|
|
| MD5 |
6c4e27f547b66cf778f221b81adfa9e9
|
|
| BLAKE2b-256 |
2f27b3f1d5bb4819ac813ab3804f15f86ac46c555179d6b7aca4c49f81bb9e2a
|