Query Yahoo Finance data from the command line using yf-cli.
Always run this before any yf command.
bash
command -v yf
If the command is not found, install it:
bash
uv tool install yf-cli
Confirm the tool is ready before continuing:
bash
yf --version
Never skip this check — assume nothing about the environment.
bash
yf quote TICKER
Returns current price, daily change, volume, and market cap.
bash
yf history TICKER [--period PERIOD] [--interval INTERVAL] [--output FORMAT]
FlagDefaultCommon values--period``1mo``1d 5d 1mo 3mo 6mo 1y 2y 5y 10y ytd max``--interval``1d``1m 5m 15m 30m 60m 1d 1wk 1mo``--outputtablejson csv
bash
yf info TICKER
Returns business summary, sector, industry, employee count, and key ratios.
bash
yf financials TICKER [--type TYPE]
--type values: income (default), balance, cashflow. Returns the most recent annual statements.
bash
yf dividends TICKER # dividend history
yf splits TICKER # stock split history
yf actions TICKER # combined dividends and splits
bash
yf analyst TICKER
Returns price targets (low / mean / high), buy/hold/sell recommendation counts, and EPS estimates.
bash
yf holders TICKER
Returns major holders, institutional holders, and insider transactions.
bash
yf calendar TICKER
Returns next earnings date, EPS estimate, and revenue estimate.
bash
yf options TICKER [--output FORMAT]
Returns calls and puts for the nearest expiry. Use --output json to process programmatically.
bash
yf search QUERY
Resolves a company name or partial ticker to a symbol. Use this when the user does not know the exact ticker.
bash
yf screen --preset PRESET
Common presets: most_actives, day_gainers, day_losers, undervalued_large_caps,
growth_technology_stocks, aggressive_small_caps.
bash
yf market
Returns sector performance and broad market indices.
bash
yf news TICKER
Returns the latest headlines and article links for a ticker.
FormatFlagUse whenTable (default)_(none)_Displaying results directly to the userJSON--output jsonParsing values, computing statistics, chaining commandsCSV--output csvExporting data for spreadsheet use
Add --no-color in environments that do not support ANSI escape codes.
User intentCommand"What is the current price of X?"yf quote TICKER"Show me X's stock history / chart data"yf history TICKER"Tell me about company X"yf info TICKER"Show X's income statement / balance sheet"yf financials TICKER --type income|balance|cashflow"When does X report earnings?"yf calendar TICKER"What do analysts think of X?"yf analyst TICKER"Who owns X?"yf holders TICKER"Show X's options"yf options TICKER"What are today's top movers?"yf screen --preset most_actives|day_gainers|day_losers"How is the market doing?"yf market"Latest news on X"yf news TICKERUnknown ticker or company nameyf search "company name"
yf quote returns no data, run yf search QUERY first to resolve the correct symbol.yf quote still returns the last closing price; note this to the user when markets are closed.