Python CLI 封装 Finnhub API,聚焦免费层实际可用的 10 个功能。
pip install finnhub-python
export FINNHUB_API_KEY="your-key-here"~/.openclaw/.env⚠️ 脚本不硬编码 Key,必须通过环境变量 FINNHUB_API_KEY 传入!
# 基础格式
FINNHUB_API_KEY="your-key" python3 scripts/finnhub_cli.py <command> [args] [--json] [--limit N]
# 推荐:设好环境变量后直接用
python3 scripts/finnhub_cli.py quote AAPL
python3 scripts/finnhub_cli.py quote AAPL
python3 scripts/finnhub_cli.py quote NVDA --json # 原始 JSON
python3 scripts/finnhub_cli.py profile AAPL
python3 scripts/finnhub_cli.py news NVDA
python3 scripts/finnhub_cli.py news AAPL --from 2026-02-01 --to 2026-02-21 --limit 5
python3 scripts/finnhub_cli.py recommend NVDA
python3 scripts/finnhub_cli.py insiders AAPL
python3 scripts/finnhub_cli.py insiders NVDA --from 2026-01-01 --to 2026-02-21
python3 scripts/finnhub_cli.py earnings # 所有股票
python3 scripts/finnhub_cli.py earnings NVDA # 指定股票
python3 scripts/finnhub_cli.py earnings --from 2026-02-21 --to 2026-03-07
python3 scripts/finnhub_cli.py financials AAPL
python3 scripts/finnhub_cli.py financials NVDA --json # 全部指标
python3 scripts/finnhub_cli.py market # 默认美国
python3 scripts/finnhub_cli.py market NYSE
python3 scripts/finnhub_cli.py peers AAPL
python3 scripts/finnhub_cli.py search "apple"
stock_candles)price_target)news_sentiment)finnhub-python(pip install finnhub-python)共 2 个版本