Yahoo Finance CLI
This skill should be used when the user asks to "get stock prices", "check stock quotes", "look up earnings", "get financial data", "find trending stocks", or needs stock market da…
stuhorsman
@stuhorsman
What This Skill Does
Command-line tool for fetching real-time stock quotes, historical data, earnings, analyst ratings, and company profiles from Yahoo Finance. Outputs JSON for programmatic use.
Replaces manually checking Yahoo Finance in a browser or building custom scrapers by providing a single CLI for all major stock data endpoints.
When to Use It
- Get real-time stock price and change for a single ticker
- Look up next earnings date for a company
- Fetch historical OHLCV data for a stock over a date range
- Search for stock symbols by company name or ticker
- View trending stocks in a specific market (e.g., US)
- Retrieve analyst recommendations and upgrade/downgrade history
Install
$ openclaw skills install @stuhorsman/yahoo-finance-cliYahoo Finance CLI
A Node.js CLI for fetching comprehensive stock data from Yahoo Finance using the yahoo-finance2 library.
Requirements
- Node.js
yahoo-finance2installed globally or available asyfjq
Install
brew install jq
npm install yahoo-finance2
sudo ln -s /opt/homebrew/bin/yahoo-finance /usr/local/bin/yf
Usage
The tool is available as yf. It outputs JSON, which can be piped to jq for filtering.
yf <module> <symbol> [queryOptions]
Modules
Quote (Real-time Price & Data)
Get real-time price, change, and basic data.
yf quote AAPL
yf quote AAPL | jq '.regularMarketPrice'
Quote Summary (Fundamentals & More)
Get detailed modules like earnings, financial data, and profiles.
# Get specific sub-modules
yf quoteSummary AAPL '{"modules":["assetProfile", "financialData", "defaultKeyStatistics"]}'
# Common modules to request:
# - assetProfile (Company info, sector)
# - financialData (Target price, margins, cash)
# - defaultKeyStatistics (Enterprise value, float, shares)
# - calendarEvents (Earnings dates)
# - earnings (History and trend)
# - recommendationTrend (Analyst ratings)
# - upgradeDowngradeHistory
Insights
Get technical and fundamental insights (valuation, outlook).
yf insights AAPL
Search
Search for symbols.
yf search "Apple"
yf search "BTC-USD"
Historical Data (Deprecated)
Get historical OHLCV data. Note: historical is deprecated; use chart instead.
# Deprecated - use chart instead
yf historical AAPL '{"period1":"2024-01-01","period2":"2024-12-31"}'
# Recommended: use chart
yf chart AAPL '{"period1":"2024-01-01","period2":"2024-12-31"}'
Trending
See what's trending.
yf trendingSymbols US
Examples
Quick Price Check
# Full JSON then filter with jq
yf quote NVDA | jq '{symbol: .symbol, price: .regularMarketPrice, changePct: .regularMarketChangePercent}'
Next Earnings Date
# Use single quotes around the JSON option in zsh/bash
yf quoteSummary TSLA '{"modules":["calendarEvents"]}' | jq '.calendarEvents.earnings.earningsDate'
Analyst Recommendations
yf quoteSummary AAPL '{"modules":["recommendationTrend"]}'
Company Profile
yf quoteSummary MSFT '{"modules":["assetProfile"]}'
Historical OHLCV
# Using chart (recommended)
yf chart AAPL '{"period1":"2024-01-01","period2":"2024-12-31","interval":"1d"}' | jq '.quotes[0:5]'
# Using historical (deprecated, but still works)
yf historical AAPL '{"period1":"2024-01-01","period2":"2024-12-31","interval":"1d"}' | jq '.[0:5]'
Search for Symbols
yf search 'Apple'
yf search 'BTC-USD'
Trending Symbols (US)
yf trendingSymbols US
Insights (valuation, outlook)
yf insights AAPL
Troubleshooting
- Cookies: The tool automatically handles cookies (stored in
~/.yf2-cookies.json). If you encounter issues, try deleting this file. - JSON Output: The output is pure JSON. Use
jqto parse it for scripts or readability.
Additional tips:
- If you see authentication or parsing errors, delete the cookie file and retry:
rm -f ~/.yf2-cookies.json
yf quote AAPL
- On macOS with zsh, prefer single quotes around JSON option arguments and use double quotes inside (see examples above).
- If you want a compact numeric value only (no jq), use a short jq filter, e.g.:
yf quote AAPL | jq -r '.regularMarketPrice'
Top skills in this category
Stock Analysis
@udiedrichsenAnalyze stocks and cryptocurrencies using Yahoo Finance data. Supports portfolio management, watchlists with alerts, dividend analysis, 8-dimension stock scoring, viral trend detection (Hot Scanner), and rumor/early signal detection. Use for stock analysis, portfolio tracking, earnings reactions, crypto monitoring, trending stocks, or finding rumors before they hit mainstream.
Stock Market Pro
@kys42Yahoo Finance (yfinance) powered stock analysis skill: quotes, fundamentals, ASCII trends, high-resolution charts (RSI/MACD/BB/VWAP/ATR), plus optional web a...
Stock Watcher
@robin797860Manage and monitor a personal stock watchlist with support for adding, removing, listing stocks, and summarizing their recent performance using data from 10jqka.com.cn. Use when the user wants to track specific stocks, get performance summaries, or manage their watchlist.
A股量化 AkShare
@mbpzA股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
Intelligent Stocks Screener
@financial-ai-analyst基于东方财富数据库,支持通过自然语言输入筛选A港美股、基金、债券等多种资产,支持多元指标筛选,含技术面、消息面、基本面及市场情绪等,可用于全球资产速筛、跨市场监控、投资组合构建、策略回测等场景。返回结果包含数据说明及 csv 文件。Natural language screener for investment...