Finnhub Skill
Use Finnhub as a read-only market data source.
Core Rules
- 1. Treat this skill as data retrieval only.
- Never place trades or modify accounts through this skill.
- Require a valid
FINNHUB_API_KEY before making live requests. - If the API key is missing, explain how to configure it instead of guessing.
- Prefer concise outputs: summary first, raw fields second.
Supported Use Cases
- - Real-time quote lookup
- K-line / candle retrieval
- Company profile lookup
- Symbol/company news lookup
- Earnings calendar / earnings history lookup
- Economic calendar lookup
- Crypto and forex reference data (if supported by the user plan)
- Structured daily stock news report (price + news + trader-style interpretation)
Configuration
Expect the user to provide:
CODEBLOCK0
Optional base URL override is supported only for the official Finnhub domain:
CODEBLOCK1
Default base URL:
CODEBLOCK2
Security rule:
- - Only allow INLINECODE1
- Do not point this skill to arbitrary hosts or proxies that could capture the API key
Execution Layer
Use the bundled script:
CODEBLOCK3
Supported commands:
- - INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
- INLINECODE6
- INLINECODE7
- INLINECODE8
Default output is human-readable. Use --raw when the user explicitly wants JSON.
Recommended Request Pattern
Use the bundled Python script for live calls instead of rebuilding requests from scratch.
When constructing requests:
- - URL-encode symbol and other parameters
- Validate time range inputs before sending
- Keep requests read-only
- If the user asks for a very broad request, narrow the scope first
Output Style
Quote
Return:
- - symbol
- current price
- absolute change
- percent change
- high / low / open / previous close
- timestamp if available
Candles
Summarize:
- - symbol
- resolution
- start/end window
- number of candles returned
- latest OHLCV row
Only dump the full array when the user explicitly asks.
Company Profile
Return:
- - company name
- ticker
- exchange
- currency
- country
- market cap
- industry / IPO date if available
- website
News
Return:
- - headline
- source
- published time
- URL
- short summary if available
Prefer 3-5 most relevant items unless the user asks for more.
Common Tasks
1. Real-time quote
Use Finnhub quote endpoint for stocks or supported symbols.
If the user gives a bare ticker like
AAPL, use it directly.
If the user gives crypto/forex, confirm Finnhub symbol format if needed.
2. Candles / K-lines
Ask for or infer:
- - symbol
- resolution (
1, 5, 15, 30, 60, D, W, M) - from timestamp
- to timestamp
If the user asks loosely (e.g. “last week”), convert it into a concrete range.
3. Company profile
Use the company profile endpoint when the user asks “what is this company”, “profile”, “market cap”, “which exchange”, etc.
4. News
Use company or market news endpoints depending on the request:
- - company-specific → company news
- broad market / macro → market news
5. Earnings / calendar
Use earnings calendar for upcoming results and earnings history if the user asks what already happened.
6. Daily stock report
When the user asks for a daily report like:
- - “发我 TSLA 昨天的新闻总结”
- “做一个 NVDA 昨日新闻日报”
- “给我 AAPL 的价格+新闻日报”
Build the report in this order:
- 1. quote / price summary first
- most important 3-5 news items
- market narrative and trader interpretation
- final rating
For the report format, read:
If candle/volume endpoints are unavailable due to Finnhub plan limits:
- - still produce the report
- explicitly say that detailed candles/volume are unavailable under current access
- avoid inventing volume comparison or trend detail
Error Handling
If Finnhub returns auth or quota errors:
- - State the likely cause clearly
- Do not fabricate fallback data
- Suggest checking API key, plan limits, or symbol format
If symbol format is ambiguous:
- - Ask one clarifying question
- Do not assume unsupported exchange suffixes
Reference File
For endpoint patterns and parameter hints, read:
Finnhub 技能
将 Finnhub 用作只读市场数据源。
核心规则
- 1. 将此技能视为仅用于数据检索。
- 切勿通过此技能进行交易或修改账户。
- 在进行实时请求前,需要提供有效的 FINNHUBAPIKEY。
- 如果缺少 API 密钥,请说明如何配置,而非自行猜测。
- 优先输出简洁内容:先摘要,后原始字段。
支持的用例
- - 实时行情查询
- K线/蜡烛图数据获取
- 公司概况查询
- 股票/公司新闻查询
- 财报日历/历史财报查询
- 经济日历查询
- 加密货币和外汇参考数据(取决于用户套餐支持情况)
- 结构化每日股票新闻报告(价格 + 新闻 + 交易员风格解读)
配置
期望用户提供:
bash
export FINNHUBAPIKEY=yourapikey
仅支持针对官方 Finnhub 域名的可选基础 URL 覆盖:
bash
export FINNHUBBASEURL=https://finnhub.io/api/v1
默认基础 URL:
text
https://finnhub.io/api/v1
安全规则:
- - 仅允许 https://finnhub.io/...
- 请勿将此技能指向可能截获 API 密钥的任意主机或代理
执行层
使用捆绑脚本:
bash
python3 scripts/finnhub.py [flags]
支持的命令:
- - quote --symbol AAPL [--raw]
- candles --symbol AAPL --resolution D --from-ts 1711584000 --to-ts 1712188800 [--raw]
- profile --symbol AAPL [--raw]
- company-news --symbol AAPL --date-from 2026-03-01 --date-to 2026-03-30 [--raw]
- market-news --category general [--raw]
- earnings --date-from 2026-03-30 --date-to 2026-04-06 [--symbol AAPL] [--raw]
- economic --date-from 2026-03-30 --date-to 2026-04-06 [--raw]
默认输出为人类可读格式。当用户明确要求 JSON 时,使用 --raw。
推荐请求模式
使用捆绑的 Python 脚本进行实时调用,而非从头重建请求。
构建请求时:
- - 对股票代码和其他参数进行 URL 编码
- 在发送前验证时间范围输入
- 保持请求为只读
- 如果用户请求范围过广,先缩小范围
输出风格
行情
返回:
- - 股票代码
- 当前价格
- 绝对涨跌额
- 涨跌幅百分比
- 最高价 / 最低价 / 开盘价 / 前收盘价
- 时间戳(如有)
蜡烛图
摘要:
- - 股票代码
- 分辨率
- 开始/结束时间窗口
- 返回的蜡烛图数量
- 最新 OHLCV 行
仅在用户明确要求时,才输出完整数组。
公司概况
返回:
- - 公司名称
- 股票代码
- 交易所
- 货币
- 国家
- 市值
- 行业 / IPO 日期(如有)
- 网站
新闻
返回:
除非用户要求更多,否则优先返回 3-5 条最相关的内容。
常见任务
1. 实时行情
使用 Finnhub 行情接口查询股票或支持的股票代码。
如果用户提供裸股票代码如 AAPL,直接使用。
如果用户提供加密货币/外汇,必要时确认 Finnhub 的股票代码格式。
2. 蜡烛图 / K线
询问或推断:
- - 股票代码
- 分辨率(1、5、15、30、60、D、W、M)
- 起始时间戳
- 结束时间戳
如果用户表述模糊(例如“上周”),将其转换为具体时间范围。
3. 公司概况
当用户询问“这家公司是什么”、“概况”、“市值”、“哪个交易所”等时,使用公司概况接口。
4. 新闻
根据请求使用公司或市场新闻接口:
- - 特定公司 → 公司新闻
- 广泛市场/宏观 → 市场新闻
5. 财报 / 日历
使用财报日历查询即将发布的业绩,使用历史财报查询已发生的事件。
6. 每日股票报告
当用户要求每日报告时,例如:
- - “发我 TSLA 昨天的新闻总结”
- “做一个 NVDA 昨日新闻日报”
- “给我 AAPL 的价格+新闻日报”
按以下顺序构建报告:
- 1. 行情/价格摘要优先
- 最重要的 3-5 条新闻
- 市场叙事和交易员解读
- 最终评级
关于报告格式,请阅读:
- - references/daily-report-template.md
如果由于 Finnhub 套餐限制无法使用蜡烛图/成交量接口:
- - 仍生成报告
- 明确说明在当前访问权限下无法获取详细的蜡烛图/成交量数据
- 避免编造成交量比较或趋势细节
错误处理
如果 Finnhub 返回认证或配额错误:
- - 清晰说明可能的原因
- 不要编造后备数据
- 建议检查 API 密钥、套餐限制或股票代码格式
如果股票代码格式不明确:
参考文件
关于接口模式和参数提示,请阅读: