Access Finnhub API for real-time stock quotes, company news, market data, financial statements, and trading signals
2026-03-27
新闻来源:网淘吧
围观:26
电脑广告
手机广告
Finnhub API
通过 Finnhub API 获取实时和历史股票市场数据、公司新闻、财务报表和市场指标。
快速开始
从以下网址获取您的 API 密钥:finnhub.io(提供免费套餐)。
在 OpenClaw 中配置:
{
skills: {
entries: {
finnhub: {
enabled: true,
apiKey: "your-finnhub-api-key",
env: {
FINNHUB_API_KEY: "your-finnhub-api-key",
},
},
},
},
}
或添加到~/.openclaw/.env:
FINNHUB_API_KEY=your-api-key-here
API 端点
基础 URL:https://finnhub.io/api/v1
所有请求都需要?token=${FINNHUB_API_KEY}参数。
股票报价(实时)
获取当前股票价格:
curl "https://finnhub.io/api/v1/quote?symbol=AAPL&token=${FINNHUB_API_KEY}"
返回:c(当前价格)、h(最高价)、l(最低价),开盘价,(开盘价),前收盘价,(前收盘价),时间戳,(时间戳)
公司新闻
获取最新公司新闻:
# News for a symbol
curl "https://finnhub.io/api/v1/company-news?symbol=AAPL&from=2025-01-01&to=2025-02-01&token=${FINNHUB_API_KEY}"
# General market news
curl "https://finnhub.io/api/v1/news?category=general&token=${FINNHUB_API_KEY}"
公司简介
获取公司信息:
curl "https://finnhub.io/api/v1/stock/profile2?symbol=AAPL&token=${FINNHUB_API_KEY}"
财务报表
获取公司财务数据:
# Income statement
curl "https://finnhub.io/api/v1/stock/financials-reported?symbol=AAPL&token=${FINNHUB_API_KEY}"
# Balance sheet
curl "https://finnhub.io/api/v1/stock/financials-reported?symbol=AAPL&statement=bs&token=${FINNHUB_API_KEY}"
# Cash flow
curl "https://finnhub.io/api/v1/stock/financials-reported?symbol=AAPL&statement=cf&token=${FINNHUB_API_KEY}"
# Search in SEC filings (10-K, 10-Q, etc.)
# Note: This endpoint may require premium tier or have a different path
curl "https://finnhub.io/api/v1/stock/search-in-filing?symbol=AAPL&query=revenue&token=${FINNHUB_API_KEY}"
市场数据
获取市场指标:
# Stock candles (OHLCV)
curl "https://finnhub.io/api/v1/stock/candle?symbol=AAPL&resolution=D&from=1609459200&to=1640995200&token=${FINNHUB_API_KEY}"
# Stock symbols (search)
curl "https://finnhub.io/api/v1/search?q=apple&token=${FINNHUB_API_KEY}"
# Market status
curl "https://finnhub.io/api/v1/stock/market-status?exchange=US&token=${FINNHUB_API_KEY}"
交易信号
获取技术指标和信号:
# Technical indicators (may require premium tier)
curl "https://finnhub.io/api/v1/indicator?symbol=AAPL&indicator=rsi&resolution=D&token=${FINNHUB_API_KEY}"
# Support/Resistance (may require premium tier)
curl "https://finnhub.io/api/v1/scan/support-resistance?symbol=AAPL&resolution=D&token=${FINNHUB_API_KEY}"
# Pattern recognition (may require premium tier)
curl "https://finnhub.io/api/v1/scan/pattern?symbol=AAPL&resolution=D&token=${FINNHUB_API_KEY}"
注意:部分技术指标接口可能需要高级订阅。免费套餐包含基本的市场数据和报价。
财报与日历
获取财报数据:
# Earnings calendar
curl "https://finnhub.io/api/v1/calendar/earnings?from=2025-02-01&to=2025-02-28&token=${FINNHUB_API_KEY}"
# Company earnings
curl "https://finnhub.io/api/v1/stock/earnings?symbol=AAPL&token=${FINNHUB_API_KEY}"
常见用例
寻找交易机会
- 搜索股票:
GET /search?q=keyword - 获取当前报价:
GET /quote?symbol=SYMBOL - 查看近期新闻:
GET /company-news?symbol=SYMBOL&from=DATE&to=DATE - 分析技术指标:
GET /indicator?symbol=SYMBOL&indicator=rsi - 审查财务数据:
GET /stock/financials-reported?symbol=SYMBOL - 搜索SEC文件:
GET /stock/search-in-filing?symbol=SYMBOL&query=KEYWORD
监控股票表现
- 获取实时报价:
GET /quote?symbol=SYMBOL - 获取历史K线数据:
GET /stock/candle?symbol=SYMBOL&resolution=D - 查看公司简介:
GET /stock/profile2?symbol=SYMBOL - 审查财报:
GET /stock/earnings?symbol=SYMBOL
研究公司新闻
- 公司特定新闻:
GET /company-news?symbol=SYMBOL - 整体市场新闻:
GET /news?category=general - 行业新闻:
GET /news?category=technology
搜索SEC文件
在公司SEC文件(10-K、10-Q、8-K等)中搜索:
# Search for specific terms in filings
# Note: This endpoint may require premium tier or have a different path
curl "https://finnhub.io/api/v1/stock/search-in-filing?symbol=AAPL&query=revenue&token=${FINNHUB_API_KEY}"
# Search for risk factors
curl "https://finnhub.io/api/v1/stock/search-in-filing?symbol=AAPL&query=risk&token=${FINNHUB_API_KEY}"
# Search for specific financial metrics
curl "https://finnhub.io/api/v1/stock/search-in-filing?symbol=AAPL&query=EBITDA&token=${FINNHUB_API_KEY}"
此端点可在SEC文件(10-K、10-Q、8-K等)中搜索特定关键词或短语,有助于在官方公司文件中查找特定主题、风险或财务指标的提及。
速率限制
免费层级:
- 60次API调用/分钟
- 实时数据:有限
- 历史数据:可用
付费层级提供更高的限制和额外功能。
注意事项
- 务必在查询参数中包含
token=${FINNHUB_API_KEY}使用正确的日期格式: - YYYY-MM-DD
YYYY-MM-DD针对日期范围 - 时间戳采用Unix纪元秒数
- 代码格式:如需请使用交易所前缀(例如,
US:AAPL表示美股) - 对于模拟交易,请将Finnhub数据与Alpaca API结合使用以执行交易
文章底部电脑广告
手机广告位-内容正文底部
上一篇:Douyin Hot Trend
下一篇:Prd


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