yahoo-finance

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Yahoo Finance CLI

Yahoo Finance CLI

Financial data terminal powered by Yahoo Finance. All commands via the
yf
script.
由Yahoo Finance驱动的金融数据终端。所有命令均通过
yf
脚本执行。

Setup

安装配置

The script is at
{baseDir}/scripts/yf
. It uses
uv run --script
with inline PEP 723 metadata — dependencies install automatically on first run.
bash
chmod +x {baseDir}/scripts/yf
脚本位于
{baseDir}/scripts/yf
。它使用带有内嵌PEP 723元数据的
uv run --script
,首次运行时会自动安装依赖。
bash
chmod +x {baseDir}/scripts/yf

Commands

命令列表

CommandPurposeExample
yf price TICKER
Quick price + change + volume
yf price YPF
yf quote TICKER
Detailed quote (52w, PE, yield)
yf quote AAPL
yf compare T1,T2,T3
Side-by-side comparison table
yf compare YPF,PAM,GGAL
yf credit TICKER
Credit analysis: leverage, coverage, debt maturity
yf credit YPF
yf macro
Morning macro dashboard (UST, DXY, VIX, oil, gold, BTC, ARS)
yf macro
yf fx [BASE]
LatAm FX rates (ARS, BRL, CLP, MXN, COP)
yf fx USD
yf flows ETF
ETF top holdings + fund data
yf flows EMB
yf history TICKER [PERIOD]
Price history (1d/5d/1mo/3mo/6mo/1y/ytd/max)
yf history YPF 3mo
yf fundamentals TICKER
Full financials (IS, BS, CF)
yf fundamentals YPF
yf news TICKER
Recent news headlines
yf news YPF
yf search QUERY
Find tickers
yf search "argentina bond"
All commands support
--json
for machine-readable output.
命令用途示例
yf price TICKER
快速查看价格+涨跌幅+成交量
yf price YPF
yf quote TICKER
详细报价(52周数据、市盈率、收益率)
yf quote AAPL
yf compare T1,T2,T3
多标的并排对比表格
yf compare YPF,PAM,GGAL
yf credit TICKER
信用分析:杠杆率、利息保障倍数、债务到期情况
yf credit YPF
yf macro
晨间宏观数据仪表盘(美国国债、DXY、VIX、原油、黄金、BTC、ARS)
yf macro
yf fx [BASE]
拉美外汇汇率(ARS、BRL、CLP、MXN、COP)
yf fx USD
yf flows ETF
ETF持仓Top榜+基金数据
yf flows EMB
yf history TICKER [PERIOD]
价格历史数据(1天/5天/1月/3月/6月/1年/年初至今/全部)
yf history YPF 3mo
yf fundamentals TICKER
完整财务数据(利润表、资产负债表、现金流表)
yf fundamentals YPF
yf news TICKER
近期新闻头条
yf news YPF
yf search QUERY
查找标的代码
yf search "argentina bond"
所有命令均支持
--json
参数,以生成机器可读的输出格式。

When to Use Which Command

命令使用场景

  • Morning check:
    yf macro
    → get UST yields, DXY, VIX, commodities, BTC, ARS in one shot
  • Quick look:
    yf price TICKER
    → fast price/change/volume
  • Deep dive equity:
    yf quote
    yf fundamentals
    yf history
  • Credit analysis:
    yf credit TICKER
    → leverage ratios, interest coverage, debt breakdown
  • EM/LatAm FX:
    yf fx
    → all major LatAm pairs vs USD
  • ETF research:
    yf flows ETF
    → top holdings, AUM, expense ratio
  • Comparison:
    yf compare
    → side-by-side for relative value
  • 晨间复盘
    yf macro
    → 一键获取美国国债收益率、DXY、VIX、大宗商品、BTC、ARS数据
  • 快速查看
    yf price TICKER
    → 快速获取价格/涨跌幅/成交量
  • 个股深度分析
    yf quote
    yf fundamentals
    yf history
  • 信用分析
    yf credit TICKER
    → 获取杠杆率、利息保障倍数、债务明细
  • 新兴市场/拉美外汇
    yf fx
    → 获取所有拉美主要货币对美元的汇率
  • ETF研究
    yf flows ETF
    → 获取持仓Top榜、资产管理规模、费率
  • 标的对比
    yf compare
    → 多标的并排对比,分析相对价值

Error Handling

错误处理

The script handles bad tickers, missing data, and rate limits gracefully with clear error messages. If Yahoo Finance rate-limits, wait a moment and retry.
脚本会优雅处理无效标的代码、缺失数据及限流问题,并给出清晰的错误提示。若触发Yahoo Finance限流,请稍候重试。

Output

输出格式

By default, output uses Rich tables for clean terminal display. Add
--json
to any command for structured JSON output suitable for piping or further processing.
默认情况下,输出使用Rich表格在终端中清晰展示。在任意命令后添加
--json
参数,可生成结构化JSON输出,便于管道传输或进一步处理。