Finnhub Pro技能使用说明
2026-03-28
新闻来源:网淘吧
围观:14
电脑广告
手机广告
Finnhub Pro — 美股金融数据 CLI
一个封装了 Finnhub API 的 Python 命令行界面工具,专注于免费层级实际可用的 10 个功能。
安装
pip install finnhub-python
API 密钥
- 前往finnhub.io注册以获取免费的 API 密钥
- 设置环境变量:
export FINNHUB_API_KEY="your-key-here" - 或者写入
~/.openclaw/.env
⚠️ 脚本不会硬编码密钥,必须通过环境变量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
免费层级支持的命令(10 个)
实时报价
python3 scripts/finnhub_cli.py quote AAPL
python3 scripts/finnhub_cli.py quote NVDA --json # 原始 JSON
公司简介
python3 scripts/finnhub_cli.py profile AAPL
公司新闻(最近 7 天)
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
内部人交易记录(最近 90 天)
python3 scripts/finnhub_cli.py insiders AAPL
python3 scripts/finnhub_cli.py insiders NVDA --from 2026-01-01 --to 2026-02-21
财报日历(未来 30 天)
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"
不可用功能(付费层)
- K线数据(
stock_candles) - 分析师目标价(
price_target) - 新闻情绪分析(
news_sentiment)
限制
- 免费层:60次/分钟
- 403 = 需付费升级
- 429 = 触发限速
依赖
- Python 3.10+
finnhub-python(pip install finnhub-python)
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~