pp-yahoo-finance
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseYahoo Finance — Printing Press CLI
Yahoo Finance — Printing Press CLI
Prerequisites: Install the CLI
前提条件:安装CLI
This skill drives the binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:
yahoo-finance-pp-cli- Install via the Printing Press installer:
bash
npx -y @mvanhorn/printing-press install yahoo-finance --cli-only - Verify:
yahoo-finance-pp-cli --version - Ensure (or
$GOPATH/bin) is on$HOME/go/bin.$PATH
If the install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.23+):
npxbash
go install github.com/mvanhorn/printing-press-library/library/commerce/yahoo-finance/cmd/yahoo-finance-pp-cli@latestIf reports "command not found" after install, the install step did not put the binary on . Do not proceed with skill commands until verification succeeds.
--version$PATH本技能基于二进制文件运行。在调用本技能的任何命令前,必须确认CLI已安装。若未安装,请先执行以下步骤:
yahoo-finance-pp-cli- 通过Printing Press安装程序安装:
bash
npx -y @mvanhorn/printing-press install yahoo-finance --cli-only - 验证安装:
yahoo-finance-pp-cli --version - 确保(或
$GOPATH/bin)已添加到$HOME/go/bin环境变量中。$PATH
若安装失败(无Node环境、离线等情况),可改用Go直接安装(需Go 1.23+版本):
npxbash
go install github.com/mvanhorn/printing-press-library/library/commerce/yahoo-finance/cmd/yahoo-finance-pp-cli@latest若安装后执行提示“command not found”,说明安装程序未将二进制文件添加到中。在验证成功前,请勿执行技能相关命令。
--version$PATHWhen to Use This CLI
何时使用本CLI
Use this CLI when the user asks about:
- stock, ETF, or fund quotes
- chart history or price ranges
- fundamentals or quote summary modules
- options chains or simple moneyness filtering
- trending symbols or predefined market screeners
- ticker search and autocomplete
- local watchlists
- portfolio cost basis and unrealized P&L
Do not use it when the user specifically needs:
- real-time streaming tick data
- exchange-grade paid data feeds
- broker/account actions like order entry
当用户询问以下内容时,可使用本CLI:
- 股票、ETF或基金报价
- 图表历史或价格区间
- 基本面数据或报价摘要模块
- 期权链或简单实值筛选
- 热门代码或预定义市场筛选器
- 代码搜索与自动补全
- 本地观察列表
- 投资组合成本基准与未实现盈亏
以下情况请勿使用本CLI:
- 需要实时流式报价数据
- 需要交易所级别的付费数据馈送
- 需要经纪商/账户操作(如下单)
Best Command Mapping
最佳命令映射
- "How is AAPL doing?" →
yahoo-finance-pp-cli quote --symbols AAPL --agent - "Give me a deeper view on Microsoft" →
yahoo-finance-pp-cli quote summary MSFT --agent - "Show me NVDA for the last year" →
yahoo-finance-pp-cli chart NVDA --range 1y --interval 1wk --agent - "What are the top gainers today?" →
yahoo-finance-pp-cli screener --scr-ids day_gainers --agent - "What is trending in the US?" →
yahoo-finance-pp-cli trending US --agent - "Track my portfolio" →
yahoo-finance-pp-cli portfolio perf --agent - "Compare AAPL, MSFT, and NVDA" →
yahoo-finance-pp-cli compare AAPL MSFT NVDA --agent - "Show me SPY options expiring soon" →
yahoo-finance-pp-cli options-chain SPY --max-dte 45 --agent
- "AAPL表现如何?" →
yahoo-finance-pp-cli quote --symbols AAPL --agent - "给我详细介绍下微软" →
yahoo-finance-pp-cli quote summary MSFT --agent - "展示NVDA过去一年的走势" →
yahoo-finance-pp-cli chart NVDA --range 1y --interval 1wk --agent - "今天涨幅最高的股票有哪些?" →
yahoo-finance-pp-cli screener --scr-ids day_gainers --agent - "美国市场热门标的有哪些?" →
yahoo-finance-pp-cli trending US --agent - "追踪我的投资组合" →
yahoo-finance-pp-cli portfolio perf --agent - "对比AAPL、MSFT和NVDA" →
yahoo-finance-pp-cli compare AAPL MSFT NVDA --agent - "展示即将到期的SPY期权" →
yahoo-finance-pp-cli options-chain SPY --max-dte 45 --agent
Unique Capabilities
独特功能
watchlist
watchlistwatchlist
(观察列表)
watchlistSave named ticker groups locally for reuse across commands.
bash
yahoo-finance-pp-cli watchlist create tech
yahoo-finance-pp-cli watchlist add tech AAPL MSFT NVDA GOOG在本地保存命名的代码组,以便在多个命令中重复使用。
bash
yahoo-finance-pp-cli watchlist create tech
yahoo-finance-pp-cli watchlist add tech AAPL MSFT NVDA GOOGportfolio
portfolioportfolio
(投资组合)
portfolioTrack local lots with purchase date and cost basis, then join them with live quotes.
bash
yahoo-finance-pp-cli portfolio add AAPL 50 185.50 --purchased 2024-06-15
yahoo-finance-pp-cli portfolio perf --agent
yahoo-finance-pp-cli portfolio gains --agent追踪包含购买日期和成本基准的本地持仓,并与实时报价关联。
bash
yahoo-finance-pp-cli portfolio add AAPL 50 185.50 --purchased 2024-06-15
yahoo-finance-pp-cli portfolio perf --agent
yahoo-finance-pp-cli portfolio gains --agentdigest
digestdigest
(摘要)
digestSummarize a watchlist into biggest gainers and losers.
bash
yahoo-finance-pp-cli digest --watchlist tech --agent将观察列表汇总为涨幅最高和跌幅最大的标的。
bash
yahoo-finance-pp-cli digest --watchlist tech --agentcompare
comparecompare
(对比)
compareShow a normalized multi-symbol comparison.
bash
yahoo-finance-pp-cli compare AAPL MSFT GOOG NVDA --agent展示标准化的多标的对比结果。
bash
yahoo-finance-pp-cli compare AAPL MSFT GOOG NVDA --agentsparkline
sparklinesparkline
(迷你走势图)
sparklineRender a compact terminal sparkline from recent chart data.
bash
yahoo-finance-pp-cli sparkline AAPL --range 3mo基于近期图表数据在终端渲染紧凑的迷你走势图。
bash
yahoo-finance-pp-cli sparkline AAPL --range 3mosql
sqlsql
sqlRun SQL directly against the local Yahoo/watchlist/portfolio database.
bash
yahoo-finance-pp-cli sql "SELECT watchlist, COUNT(*) FROM watchlist_members GROUP BY watchlist" --agent直接对本地Yahoo/观察列表/投资组合数据库执行SQL查询。
bash
yahoo-finance-pp-cli sql "SELECT watchlist, COUNT(*) FROM watchlist_members GROUP BY watchlist" --agentfx
fxfx
(汇率转换)
fxConvert currencies without manually building Yahoo FX pair symbols.
bash
yahoo-finance-pp-cli fx USD EUR --amount 100 --agent无需手动构建Yahoo汇率对代码即可转换货币。
bash
yahoo-finance-pp-cli fx USD EUR --amount 100 --agentoptions-chain
options-chainoptions-chain
(期权链)
options-chainFilter Yahoo's raw chain into a usable options view by moneyness and DTE.
bash
yahoo-finance-pp-cli options-chain AAPL --moneyness otm --max-dte 45 --type calls --agent根据实值状态和到期天数(DTE)将Yahoo原始期权链筛选为可用视图。
bash
yahoo-finance-pp-cli options-chain AAPL --moneyness otm --max-dte 45 --type calls --agentauth login-chrome
auth login-chromeauth login-chrome
auth login-chromeImport a browser session when Yahoo blocks the automatic crumb bootstrap from the current IP.
bash
yahoo-finance-pp-cli auth login-chrome --cookies ~/yahoo-cookies.json --crumb abc123当Yahoo从当前IP自动获取crumb失败时,导入浏览器会话。
bash
yahoo-finance-pp-cli auth login-chrome --cookies ~/yahoo-cookies.json --crumb abc123Command Reference
命令参考
Market data:
yahoo-finance-pp-cli quote --symbols AAPL,MSFTyahoo-finance-pp-cli quote summary AAPLyahoo-finance-pp-cli chart AAPL --range 1mo --interval 1dyahoo-finance-pp-cli fundamentals AAPL --type annualTotalRevenueyahoo-finance-pp-cli insights --symbol AAPLyahoo-finance-pp-cli options AAPLyahoo-finance-pp-cli recommendations AAPLyahoo-finance-pp-cli screener --scr-ids day_gainersyahoo-finance-pp-cli trending USyahoo-finance-pp-cli search "apple"yahoo-finance-pp-cli autocomplete --query appl
Local-state and derived workflows:
yahoo-finance-pp-cli watchlist create|add|remove|list|show|deleteyahoo-finance-pp-cli portfolio add|list|remove|perf|gainsyahoo-finance-pp-cli digestyahoo-finance-pp-cli compareyahoo-finance-pp-cli sparklineyahoo-finance-pp-cli sqlyahoo-finance-pp-cli fxyahoo-finance-pp-cli options-chain
Utilities:
yahoo-finance-pp-cli syncyahoo-finance-pp-cli workflow archiveyahoo-finance-pp-cli workflow statusyahoo-finance-pp-cli exportyahoo-finance-pp-cli importyahoo-finance-pp-cli doctoryahoo-finance-pp-cli auth statusyahoo-finance-pp-cli auth logoutyahoo-finance-pp-cli auth login-chrome
市场数据类:
yahoo-finance-pp-cli quote --symbols AAPL,MSFTyahoo-finance-pp-cli quote summary AAPLyahoo-finance-pp-cli chart AAPL --range 1mo --interval 1dyahoo-finance-pp-cli fundamentals AAPL --type annualTotalRevenueyahoo-finance-pp-cli insights --symbol AAPLyahoo-finance-pp-cli options AAPLyahoo-finance-pp-cli recommendations AAPLyahoo-finance-pp-cli screener --scr-ids day_gainersyahoo-finance-pp-cli trending USyahoo-finance-pp-cli search "apple"yahoo-finance-pp-cli autocomplete --query appl
本地状态与衍生工作流类:
yahoo-finance-pp-cli watchlist create|add|remove|list|show|deleteyahoo-finance-pp-cli portfolio add|list|remove|perf|gainsyahoo-finance-pp-cli digestyahoo-finance-pp-cli compareyahoo-finance-pp-cli sparklineyahoo-finance-pp-cli sqlyahoo-finance-pp-cli fxyahoo-finance-pp-cli options-chain
工具类:
yahoo-finance-pp-cli syncyahoo-finance-pp-cli workflow archiveyahoo-finance-pp-cli workflow statusyahoo-finance-pp-cli exportyahoo-finance-pp-cli importyahoo-finance-pp-cli doctoryahoo-finance-pp-cli auth statusyahoo-finance-pp-cli auth logoutyahoo-finance-pp-cli auth login-chrome
Practical Recipes
实用示例
Morning briefing over a watchlist
基于观察列表的晨间简报
bash
yahoo-finance-pp-cli watchlist create tech
yahoo-finance-pp-cli watchlist add tech AAPL MSFT NVDA GOOG META
yahoo-finance-pp-cli digest --watchlist tech --agentbash
yahoo-finance-pp-cli watchlist create tech
yahoo-finance-pp-cli watchlist add tech AAPL MSFT NVDA GOOG META
yahoo-finance-pp-cli digest --watchlist tech --agentTrack a real portfolio with cost basis
追踪带成本基准的真实投资组合
bash
yahoo-finance-pp-cli portfolio add AAPL 50 185.50 --purchased 2024-06-15
yahoo-finance-pp-cli portfolio add MSFT 20 340.00 --purchased 2024-03-01
yahoo-finance-pp-cli portfolio perf --agent
yahoo-finance-pp-cli portfolio gains --agentbash
yahoo-finance-pp-cli portfolio add AAPL 50 185.50 --purchased 2024-06-15
yahoo-finance-pp-cli portfolio add MSFT 20 340.00 --purchased 2024-03-01
yahoo-finance-pp-cli portfolio perf --agent
yahoo-finance-pp-cli portfolio gains --agentCompare several large-cap names
对比多个大盘股
bash
yahoo-finance-pp-cli compare AAPL MSFT NVDA GOOG --agentbash
yahoo-finance-pp-cli compare AAPL MSFT NVDA GOOG --agentFallback when Yahoo blocks your IP
Yahoo IP封禁时的解决方案
bash
yahoo-finance-pp-cli auth login-chrome --cookies ~/yahoo-cookies.json --crumb abc123
yahoo-finance-pp-cli doctorbash
yahoo-finance-pp-cli auth login-chrome --cookies ~/yahoo-cookies.json --crumb abc123
yahoo-finance-pp-cli doctorSession Model
会话模型
Yahoo Finance uses a crumb/cookie session model, not an API key model.
- first live request: the CLI tries to bootstrap the session automatically
- if Yahoo blocks that bootstrap with HTTP 429: use
auth login-chrome - inspect cached state:
auth status - clear a bad cached session:
auth logout
Yahoo Finance采用crumb/ Cookie会话模型,而非API密钥模型。
- 首次实时请求:CLI尝试自动初始化会话
- 若Yahoo返回HTTP 429错误阻止初始化:使用命令
auth login-chrome - 查看缓存状态:
auth status - 清除无效缓存会话:
auth logout
Agent Mode
Agent模式
Add when you want machine-oriented output.
--agentIt expands to:
--json--compact--no-input--no-color--yes
Useful companion flags:
--select <fields>--dry-run--no-cache--data-source auto|live|local--rate-limit <n>
当需要面向机器的输出时,添加参数。
--agent该参数等价于同时设置:
--json--compact--no-input--no-color--yes
实用的配套参数:
--select <fields>--dry-run--no-cache--data-source auto|live|local--rate-limit <n>
Filtering output
输出筛选
--selectbash
yahoo-finance-pp-cli <command> --agent --select id,name
yahoo-finance-pp-cli <command> --agent --select items.id,items.owner.nameUse this to narrow huge payloads to the fields you actually need — critical for deeply nested API responses.
--selectbash
yahoo-finance-pp-cli <command> --agent --select id,name
yahoo-finance-pp-cli <command> --agent --select items.id,items.owner.name使用该参数可将庞大的响应缩小到实际需要的字段——这在处理深度嵌套的API响应时至关重要。
Response envelope
响应信封
Data-layer commands wrap output in . Parse for data and to know whether it's or local. The summary is printed to stderr only when stdout is a TTY; piped/agent consumers see pure JSON on stdout.
{"meta": {...}, "results": <data>}.results.meta.sourceliveN results (live)数据层命令会将输出包裹在结构中。解析获取数据,通过判断数据是(实时)还是本地缓存。仅当stdout为TTY时,摘要才会打印到stderr;管道/Agent消费者只会在stdout看到纯JSON。
{"meta": {...}, "results": <data>}.results.meta.sourceliveN results (live)Exit Codes
退出码
| Code | Meaning |
|---|---|
| 0 | Success |
| 2 | Usage error |
| 3 | Resource not found |
| 4 | Session/auth-style error |
| 5 | API error |
| 7 | Rate limited |
| 10 | Config error |
| 代码 | 含义 |
|---|---|
| 0 | 成功 |
| 2 | 使用错误 |
| 3 | 资源未找到 |
| 4 | 会话/认证类错误 |
| 5 | API错误 |
| 7 | 速率限制 |
| 10 | 配置错误 |
Argument Parsing
参数解析
Given :
$ARGUMENTS- Empty, , or
help→ run--helpyahoo-finance-pp-cli --help - → install CLI
install - → install MCP server
install mcp - Anything else → map the user request to the best command above and run it with
--agent
针对:
$ARGUMENTS- 为空、或
help→ 执行--helpyahoo-finance-pp-cli --help - → 安装CLI
install - → 安装MCP服务器
install mcp - 其他内容 → 将用户请求映射到上述最匹配的命令,并添加参数执行
--agent
MCP Server Installation
MCP服务器安装
bash
go install github.com/mvanhorn/printing-press-library/library/commerce/yahoo-finance/cmd/yahoo-finance-pp-mcp@latest
claude mcp add yahoo-finance yahoo-finance-pp-mcpbash
go install github.com/mvanhorn/printing-press-library/library/commerce/yahoo-finance/cmd/yahoo-finance-pp-mcp@latest
claude mcp add yahoo-finance yahoo-finance-pp-mcpDirect Use
直接使用流程
- Check whether is installed.
yahoo-finance-pp-cli - If not installed, offer CLI installation.
- Choose the command that matches the user's intent most directly.
- Run with unless the user explicitly wants human-formatted output.
--agent - If Yahoo is rate-limiting this machine, guide the user to .
auth login-chrome
- 检查是否已安装。
yahoo-finance-pp-cli - 若未安装,提供CLI安装选项。
- 选择与用户意图最匹配的命令。
- 除非用户明确需要面向人类的格式化输出,否则添加参数执行。
--agent - 若Yahoo对当前机器进行速率限制,引导用户执行命令。
auth login-chrome
Agent Workflow Features
Agent工作流特性
This CLI exposes three shared agent-workflow capabilities patched in from cli-printing-press PR #218.
本CLI提供三个从cli-printing-press PR #218中引入的通用Agent工作流功能。
Named profiles
命名配置文件
Persist a set of flags under a name and reuse them across invocations.
bash
undefined将一组参数保存为命名配置文件,以便在多次调用中复用。
bash
undefinedSave the current non-default flags as a named profile
将当前非默认参数保存为命名配置文件
yahoo-finance-pp-cli profile save <name>
yahoo-finance-pp-cli profile save <name>
Use a profile — overlays its values onto any flag you don't set explicitly
使用配置文件——其值会覆盖未显式设置的参数
yahoo-finance-pp-cli --profile <name> <command>
yahoo-finance-pp-cli --profile <name> <command>
List / inspect / remove
列出/查看/删除配置文件
yahoo-finance-pp-cli profile list
yahoo-finance-pp-cli profile show <name>
yahoo-finance-pp-cli profile delete <name> --yes
Flag precedence: explicit flag > env var > profile > default.yahoo-finance-pp-cli profile list
yahoo-finance-pp-cli profile show <name>
yahoo-finance-pp-cli profile delete <name> --yes
参数优先级:显式参数 > 环境变量 > 配置文件 > 默认值。--deliver
--deliver
Route command output to a sink other than stdout. Useful when an agent needs to hand a result to a file, a webhook, or another process without plumbing.
bash
yahoo-finance-pp-cli <command> --deliver file:/path/to/out.json
yahoo-finance-pp-cli <command> --deliver webhook:https://hooks.example/inFile sinks write atomically (tmp + rename). Webhook sinks POST (or when is set). Unknown schemes produce a structured refusal listing the supported set.
application/jsonapplication/x-ndjson--compact将命令输出路由到stdout以外的目标。当Agent需要将结果传递到文件、Webhook或其他进程而无需额外处理时非常有用。
bash
yahoo-finance-pp-cli <command> --deliver file:/path/to/out.json
yahoo-finance-pp-cli <command> --deliver webhook:https://hooks.example/in文件目标会以原子方式写入(先写入临时文件再重命名)。Webhook目标会POST (设置时为)。未知协议会返回结构化提示,列出支持的协议类型。
application/json--compactapplication/x-ndjsonfeedback
feedback(反馈)
Record in-band feedback about this CLI from the agent side of the loop. Local-only by default; safe to call without configuration.
bash
yahoo-finance-pp-cli feedback "what surprised you or tripped you up"
yahoo-finance-pp-cli feedback list # show local entries
yahoo-finance-pp-cli feedback clear --yes # wipeEntries append to as JSON lines. When is set and either is passed or , the entry is also POSTed upstream (non-blocking — local write always succeeds).
~/.yahoo-finance-pp-cli/feedback.jsonlYAHOO_FINANCE_FEEDBACK_ENDPOINT--sendYAHOO_FINANCE_FEEDBACK_AUTO_SEND=true从Agent端记录关于本CLI的内置反馈。默认仅本地存储;无需配置即可安全调用。
bash
yahoo-finance-pp-cli feedback "what surprised you or tripped you up"
yahoo-finance-pp-cli feedback list # 显示本地记录
yahoo-finance-pp-cli feedback clear --yes # 清除记录记录会以JSON行格式追加到。当设置了且传递了参数或时,记录还会被POST到上游(非阻塞——本地写入始终成功)。
~/.yahoo-finance-pp-cli/feedback.jsonlYAHOO_FINANCE_FEEDBACK_ENDPOINT--sendYAHOO_FINANCE_FEEDBACK_AUTO_SEND=true