Skip to content

mtzanidakis/yfinance-cli

Repository files navigation

yfinance-cli

CLI client for Yahoo Finance API.

Installation

go install github.com/mtzanidakis/yfinance-cli@latest

Or download a binary from the releases page.

Usage

yfinance-cli <command> <subcommand> [flags]

Commands

Command Description
quote Real-time quotes for one or more symbols
chart Historical OHLCV price data
search Search for securities by name or ticker
profile Company profile and key statistics
financials Income statement, balance sheet, cash flow
analysis Analyst recommendations, earnings, price targets
holders Major holders, institutional, insider ownership
options Options chains and expiration dates

Global Flags

Flag Description
-raw Compact JSON output (no indentation)
-no-ratelimit Bypass rate limit check

Examples

# Get real-time quote
yfinance-cli quote get -symbols AAPL,MSFT,GOOGL

# Historical data for last year
yfinance-cli chart get -symbol AAPL -range 1y

# Historical data with custom date range
yfinance-cli chart get -symbol AAPL -from 2025-01-01 -to 2025-12-31

# Search for securities
yfinance-cli search query -q "tesla"

# Company profile
yfinance-cli profile get -symbol MSFT

# Key statistics
yfinance-cli profile stats -symbol AAPL

# Financial statements
yfinance-cli financials income -symbol AAPL
yfinance-cli financials balance -symbol AAPL -quarterly
yfinance-cli financials cashflow -symbol AAPL

# Analyst data
yfinance-cli analysis recommendations -symbol AAPL
yfinance-cli analysis earnings -symbol MSFT
yfinance-cli analysis targets -symbol GOOGL

# Holders
yfinance-cli holders major -symbol AAPL
yfinance-cli holders institutional -symbol MSFT

# Options
yfinance-cli options expirations -symbol AAPL
yfinance-cli options chain -symbol AAPL -expiration 2026-06-19

# Market indices (use ^ prefix)
yfinance-cli quote get -symbols ^GSPC,^IXIC,^VIX,^DJI
yfinance-cli chart get -symbol ^GSPC -range 5d

Output

All commands output JSON to stdout. Errors go to stderr. Use -raw for compact output suitable for piping.

# Pretty-printed (default)
yfinance-cli quote get -symbols AAPL

# Compact for piping
yfinance-cli quote get -symbols AAPL -raw | jq '.quoteResponse.result[0].regularMarketPrice'

Rate Limiting

Client-side rate limiting is enforced at 60 requests per minute. State is stored in ~/.yfinance-cli/ratelimit.json. Use -no-ratelimit to bypass.

License

MIT

About

CLI client for Yahoo Finance API

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors