FactIQ:为 AI Agent 打造的实时金融经济数据库
英文标题:🔶 Show HN: FactIQ – a realtime econ+finance database for AI agents
FactIQ 是一个面向 AI Agent 的实时金融经济数据库插件,支持 Claude Code 和 OpenAI Codex。它通过统一的 MCP 服务器直接访问 SEC 文件、中美印韩等约 20 个官方数据源和实时市场数据,所有数据被标准化为三张核心表。Agent 能够自主发现数据、运行只读 SQL 并发布可分享的图表、报告或终端预览,无需任何代码库或托管数据库。开发者只需免费 FactIQ 账户即可快速安装,高度模块化的插件欢迎贡献领域操作手册来扩展分析能力,这极大降低了 AI 驱动金融分析的门槛并增强了可扩展性。
45.1 KB
中文
FactIQ - 为 AI 代理打造的实时金融经济数据库
将您的代理转变为金融经济分析师。这个 Claude Code 和 Codex 的插件直接赋予代理访问 FactIQ 官方统计数据库的能力——包括 SEC 文件、美国、中国、印度、韩国、国际货币基金组织、世界银行等数据——以及实时市场数据和财报电话会议情报。代理可以发现数据序列、在 FactIQ 数据库上运行只读 SQL、计算衍生指标,并将结果发布为可分享的 FactIQ 图表或报告、终端预览或定制的本地 HTML 可视化。
不需要代码库或托管数据库——只需一个免费的 FactIQ 账户。
想要贡献?最具影响力的补充是领域操作手册,它教会代理处理一整类问题——请参见贡献部分。
/plugin marketplace add defog-ai/factiq-plugin
/plugin install factiq@factiq
/reload-plugins
安装后运行 /reload-plugins 让 Claude Code 在当前会话中加载新技能、MCP 服务器和命令(否则仅下次启动时生效)。
这会添加技能(代理自动针对经济/金融数据问题调用)、捆绑的 FactIQ MCP 服务器以及 /factiq:ask 命令:
| 命令 | 用途 |
|---|---|
/factiq:ask <question> |
运行完整分析并获取可分享的图表、终端图表或报告 |
最后,授权 MCP 服务器:
- 运行
/mcp。 - 从服务器列表中选择 factiq。
- 选择 Authenticate(或 Connect)打开浏览器登录。
- 完成 FactIQ 登录(电子邮件、Google 或 Passkey)并返回 Claude Code——FactIQ 工具现已授权。
启用自动更新
为确保始终获得最新的技能、MCP 工具和命令而无需重新安装,请开启市场自动更新:
- 运行
/plugin。 - 选择 Marketplaces。
- 选择 factiq。
- 将 auto-updates 切换为开启。
Claude Code 此后将在该市场变更时自动刷新插件。
codex plugin marketplace add defog-ai/factiq-plugin
codex plugin add factiq@factiq
然后授权 MCP 服务器:
完成浏览器登录(使用相同的 FactIQ 登录方式:电子邮件、Google 或 Passkey)。安装后启动一个新的 Codex 会话;技能将自动针对经济/金融数据问题调用。
更新现有 Codex 安装
要在市场变更后更新,刷新已配置的市场名称(factiq),然后重新安装插件:
codex plugin marketplace upgrade factiq
codex plugin add factiq@factiq
替代方案:作为独立 MCP 服务器安装(无插件)
直接将 MCP 服务器添加到 Codex 配置(~/.codex/config.toml):
[mcp_servers.factiq]
url = "https://api.factiq.com/mcp"
然后运行 codex mcp login factiq。如果不使用插件,技能不会自动调用,但 MCP 工具可手动使用。
对于无插件的 Claude Code:
claude mcp add --transport http factiq https://api.factiq.com/mcp
然后使用 /mcp 授权。
安装并认证后,提出问题:
/factiq:ask 自2020年以来印度对华贸易逆差如何演变?
代理将找到相关序列,运行 SQL,并回复一个可分享的 factiq.com 图表链接——或根据您的要求提供终端图表或完整报告。您无需使用斜杠命令:在普通 Claude Code 或 Codex 对话中的任何经济或金融数据问题都会自动调用该技能。
您的编程代理就是分析师:它将问题分解、查找数据、进行数学计算、生成输出并发布——全部通过调用 FactIQ MCP 服务器 的工具(捆绑在 .mcp.json 中),Claude Code 和 Codex 通过单一 OAuth 连接原生与之通信。
┌─────────────────────────────┐
│ Claude Code / Codex │
│ + factiq skill (SKILL.md) │ the agent orchestrates everything
└──────────────┬──────────────┘
│ MCP over HTTP (one OAuth connection)
┌──────────────▼──────────────┐
│ FactIQ MCP server │
│ │
│ discover search_datasets, describe_dataset, search_series,
│ get_data_catalog
│ fetch run_sql (read-only), get_series, get_market_data,
│ search_earnings
│ publish share_chart, share_report
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ FactIQ data warehouse │ ~20 official sources, one schema
│ + factiq.com share pages │ published charts/reports render here
└─────────────────────────────┘
之所以一个技能能够用相同的 SQL 习惯查询 BLS 失业率、中国海关流量、印度央行货币数据和世界银行指标,是因为每个后端数据源都被标准化为相同的三张核心表,每个模式完全相同:
| 表 | 内容 |
|---|---|
series |
目录——每行一个序列:id、标题、描述、数据集、频率、单位、季节性、地理、时间覆盖范围 |
data_points |
值——(series_id, time, value),已索引以实现快速检索 |
dimensions |
分面元数据——(series_id, dimension_type, dimension_code, dimension_name),例如贸易数据的 partner、flow、commodity、hs_level |
我们的摄取管道承担了将每个源独特格式(BLS 平面文件、BEA API、海关记录、印度储备银行发布)展平成此形状的繁重工作,因此代理学习一次模型即可在所有地方工作。发现、透视和过滤在所有约 20 个模式中遵循相同模式;配方存放在 references/data/sql-guide.md。
| 区域 | 模式 |
|---|---|
| 美国 | SEC 文件、BLS(就业、CPI、JOLTS、OEWS)、Census(贸易含 HS 级别、零售、住房)、BEA(GDP、收入)、EIA(能源)、USDA ERS、BTS(交通)、财报电话情报 |
| 中国 | NBS 宏观指标、GACC 海关(HS 级别贸易) |
| 印度 | MOSPI(CPI、WPI、IIP、GDP)、RBI(银行、利率、外汇)、DGCI&S 贸易(HS 级别)、城市交通 |
| 韩国 | KCS 海关(HS 级别贸易) |
| 全球 | IMF、世界银行、新加坡 SingStat、实时市场数据(报价、基本面、外汇、大宗商品) |
references/data/schemas.md 提供静态概览;get_data_catalog 工具返回实时权威版本。
行为所在位置——贡献者将接触的文件:
skills/factiq/SKILL.md— 技能定义和工作流的单一真实来源。由 Claude Code 和 Codex 从skills/目录自动发现references/data/— 数据层:SQL 习惯(sql-guide.md)和数据集模式概览(schemas.md)references/output/— 发布格式:ChartSpec(chart-spec.md)、报告 JSON(report-spec.md)和定制可视化指南(viz-guide.md)references/report-patterns/— 领域操作手册(货币政策、双边贸易、双边经济政策、财政政策收入、企业形成)。report-patterns/README.md是 SKILL.md 引用的单一入口点:它教授所有报告遵循的辩证方法(正题→反题→合题),并将每个领域路由到其操作手册,因此添加操作手册无需修改 SKILL.mdcommands/ask.md—/factiq:ask斜杠命令(Claude Code)scripts/term_chart.py— 仅使用标准库的渲染器,从 FactIQ ChartSpec JSON 和share_report报告对象打印 ANSI/ASCII 终端预览。支持柱状图、简单折线图和表格回退渲染器scripts/build_viz.py— 仅限本地的工具,将获取的数据组装成自包含的 HTML 可视化,并对其进行无头截图以进行迭代;用法见references/output/viz-guide.mdassets/viz-shell.html— 定制可视化的起始模板
插件基础设施——通常不需要修改这些:
.mcp.json— 声明捆绑的 FactIQ MCP 服务器(可流式 HTTP、OAuth)。由 Claude Code 和 Codex 插件加载器读取.claude-plugin/— Claude Code 插件 + 市场清单.codex-plugin/— Codex 插件清单.agents/plugins/marketplace.json—codex plugin marketplace add defog-ai/factiq-plugin使用的 Codex 市场条目
欢迎贡献——此插件旨在与社区共同成长。提出 issue 或拉取请求。
定制技能(领域操作手册)——最具影响力的贡献
您可以添加的最有价值的东西是领域操作手册:一个参考文件,教代理如何出色地回答一整类问题。操作手册是提前写好的领域辩证法——问题引发的标题阅读,一个称职的怀疑者会提出的矛盾,以及获取二者的 SQL(参见 references/report-patterns/README.md 中的方法)。现有的手册位于 references/report-patterns/ 中,是可以效仿的模式:
一个优秀的操作手册包含:
- 触发器——涵盖哪些问题形态(“A 和 B 之间贸易的最新趋势”、“解读美联储立场”),作为行添加到
references/report-patterns/README.md的路由表中,以便代理在抓取之前读取操作手册。SKILL.md指向该路由器,因此无需更改。 - 必要覆盖——领域的规范反题:完整答案必须获取的对抗性检查(镜像统计、实际 vs 名义、构成、对手方账本),以便代理不会止步于第一个显而易见的图表。
- 现成的 SQL 模板——针对三表模式的关键计算(最新月度同比、年初至今比较、前 N 名驱动因素)测试过的查询。
- 注意事项和护栏——单位归一化、基年变化、国家级与次国家级陷阱、需明确披露的数据缺口。
我们希望看到的想法:劳动力市场健康、通胀分解、能源市场、住房、主权债务、行业盈利分析、国家宏观风险快照。
其他欢迎的贡献
- 终端渲染器 —
scripts/term_chart.py中的新图表类型或更好的 ASCII/ANSI 输出(保持仅标准库)。 - 可视化配方 —
build_viz.py和references/output/viz-guide.md的可复用模式。 - SQL 习惯和陷阱 — 从实际使用中为
references/data/sql-guide.md补充内容。 - 文档和修复 — 任何能使代理首次尝试即成功的东西。
通过技能端到端运行操作手册所针对的问题,并检查发布输出来测试操作手册;展示前后分享链接的 PR 描述是最有说服力的审查材料。
此仓库不应包含任何秘密,且插件本身也不持有——所有访问通过 MCP 服务器的 OAuth 流程进行,因此编程代理持有令牌,此处不写入任何内容。所有 SQL 只读运行在 FactIQ 数据仓库上。
English / 原文
FactIQ - a real-time finance and economy database for AI Agents
Turn your agent into a finance and economy analyst. This plugin for Claude Code and Codex gives the agent direct access to FactIQ's warehouse of official statistics — SEC filings, US, China, India, Korea, IMF, World Bank, and more — plus live market data and earnings-call intelligence. The agent discovers series, runs read-only SQL on FactIQ's database, computes derived metrics, and publishes the result as a shareable FactIQ chart or report, a terminal preview, or a bespoke local HTML visualization.
No codebase or hosted database is required — only a free FactIQ account.
Want to contribute? The highest-leverage addition is a domain playbook that teaches the agent a whole class of questions — see Contributing.
/plugin marketplace add defog-ai/factiq-plugin
/plugin install factiq@factiq
/reload-plugins
Run /reload-plugins after installing so Claude Code picks up the new skill, MCP server, and command in the current session (otherwise they only appear the next time you start Claude Code).
This adds the skill (Claude invokes it automatically for economic/financial data questions), the bundled FactIQ MCP server, and the /factiq:ask command:
| Command | Purpose |
|---|---|
/factiq:ask <question> |
Run a full analysis and get a shareable chart, terminal chart, or report |
Finally, authenticate the MCP server:
- Run
/mcp. - Select factiq from the list of servers.
- Choose Authenticate (or Connect) to open the browser sign-in.
- Complete the FactIQ login (email, Google, or passkey) and return to Claude Code — the FactIQ tools are now authorized.
Enable auto-updates
So you always get the latest skill, MCP tools, and commands without reinstalling, turn on auto-updates for the marketplace:
- Run
/plugin. - Select Marketplaces.
- Select factiq.
- Toggle auto-updates on.
Claude Code will then refresh the plugin automatically whenever this marketplace changes.
codex plugin marketplace add defog-ai/factiq-plugin
codex plugin add factiq@factiq
Then authorize the MCP server:
Complete the browser sign-in (the same FactIQ login: email, Google, or passkey). Start a new Codex thread after installation; the skill auto-invokes for economic/financial data questions.
Update an existing Codex install
To update after this marketplace changes, refresh the configured marketplace name (factiq), then reinstall the plugin:
codex plugin marketplace upgrade factiq
codex plugin add factiq@factiq
Alternative: install as a standalone MCP server (no plugin)
Add the MCP server directly to your Codex config (~/.codex/config.toml):
[mcp_servers.factiq]
url = "https://api.factiq.com/mcp"
Then codex mcp login factiq. The skill won't auto-invoke without the plugin, but the MCP tools are available for manual use.
For Claude Code without the plugin:
claude mcp add --transport http factiq https://api.factiq.com/mcp
Then authorize with /mcp.
Once installed and authenticated, ask a question:
/factiq:ask How has India's trade deficit with China evolved since 2020?
The agent finds the relevant series, runs the SQL, and replies with a shareable factiq.com chart link — or a terminal chart or full report, depending on what you ask for. You don't need the slash command: any economic or financial data question in a normal Claude Code or Codex conversation auto-invokes the skill.
Your coding agent is the analyst : it decomposes the question, finds the data, does the math, authors the output, and publishes it — all through tool calls to the FactIQ MCP server (bundled in .mcp.json), which Claude Code and Codex talk to natively over a single OAuth connection.
┌─────────────────────────────┐
│ Claude Code / Codex │
│ + factiq skill (SKILL.md) │ the agent orchestrates everything
└──────────────┬──────────────┘
│ MCP over HTTP (one OAuth connection)
┌──────────────▼──────────────┐
│ FactIQ MCP server │
│ │
│ discover search_datasets, describe_dataset, search_series,
│ get_data_catalog
│ fetch run_sql (read-only), get_series, get_market_data,
│ search_earnings
│ publish share_chart, share_report
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ FactIQ data warehouse │ ~20 official sources, one schema
│ + factiq.com share pages │ published charts/reports render here
└─────────────────────────────┘
The reason a single skill can query BLS unemployment, Chinese customs flows, RBI monetary data, and World Bank indicators with the same SQL idioms: every data source in the backend is normalized into the same three core tables , identical in every schema:
| Table | What it holds |
|---|---|
series |
The catalog — one row per series: id, title, description, dataset, frequency, units, seasonality, geography, time coverage |
data_points |
The values — (series_id, time, value), indexed for fast retrieval |
dimensions |
Faceted metadata — (series_id, dimension_type, dimension_code, dimension_name), e.g. partner, flow, commodity, hs_level for trade data |
Our ingestion pipelines do the hard work of flattening each source's bespoke format — BLS flat files, BEA APIs, customs records, RBI releases — into this shape, so the agent learns the model once and it works everywhere. Discovery, pivoting, and filtering follow the same patterns across all ~20 schemas; the recipes live in references/data/sql-guide.md.
| Region | Schemas |
|---|---|
| United States | SEC filings data, BLS (employment, CPI, JOLTS, OEWS), Census (trade incl. HS-level, retail, housing), BEA (GDP, income), EIA (energy), USDA ERS, BTS (transportation), earnings-call intelligence |
| China | NBS macro indicators, GACC customs (HS-level trade) |
| India | MOSPI (CPI, WPI, IIP, GDP), RBI (banking, rates, forex), DGCI&S trade (HS-level), city traffic |
| South Korea | KCS customs (HS-level trade) |
| Global | IMF, World Bank, Singapore SingStat, live market data (quotes, fundamentals, FX, commodities) |
references/data/schemas.md has the static overview; the get_data_catalog tool returns the live, authoritative version.
Where the behavior lives — the files contributors will touch:
skills/factiq/SKILL.md— the skill definition and single source of truth for the workflow. Auto-discovered by both Claude Code and Codex from theskills/directoryreferences/data/— the data layer: SQL idioms (sql-guide.md) and the dataset schema overview (schemas.md)references/output/— publishing formats: ChartSpec (chart-spec.md), report JSON (report-spec.md), and the bespoke-viz guide (viz-guide.md)references/report-patterns/— domain playbooks (monetary policy, bilateral trade, bilateral economic policy, fiscal-policy revenue, business formation).report-patterns/README.mdis the single entry point SKILL.md references: it teaches the dialectical method (thesis → antithesis → synthesis) all reports follow and routes each domain to its playbook, so adding a playbook doesn't touch SKILL.mdcommands/ask.md— the/factiq:askslash command (Claude Code)scripts/term_chart.py— stdlib-only renderer that prints ANSI/ASCII terminal previews from FactIQ ChartSpec JSON andshare_reportreport objects. It supports bar, simple line, and table fallback renderersscripts/build_viz.py— local-only tool that assembles fetched data into a self-contained HTML viz and screenshots it headless for iteration; usage inreferences/output/viz-guide.mdassets/viz-shell.html— starting-point shell for bespoke visualizations
Plugin plumbing — you shouldn't need to touch these:
.mcp.json— declares the bundled FactIQ MCP server (Streamable HTTP, OAuth). Read by both Claude Code and Codex plugin loaders.claude-plugin/— Claude Code plugin + marketplace manifests.codex-plugin/— Codex plugin manifest.agents/plugins/marketplace.json— Codex marketplace entry forcodex plugin marketplace add defog-ai/factiq-plugin
Contributions are welcome — this plugin is meant to grow with its community. Open an issue or a pull request.
Bespoke skills (domain playbooks) — the highest-leverage contribution
The most valuable thing you can add is a domain playbook : a reference file that teaches the agent how to answer a whole class of questions well. A playbook is a domain's dialectic written down in advance — the headline reading a question invites, the contradictions a competent skeptic would raise against it, and the SQL to fetch both (see the method in references/report-patterns/README.md). The existing ones live in references/report-patterns/ and are the pattern to follow:
A good playbook contains:
- A trigger — which question shapes it covers ("latest trend in trade between A and B", "explain the Fed's stance"), added as a row to the routing table in
references/report-patterns/README.mdso the agent reads the playbook before fetching.SKILL.mdpoints at that router, so it doesn't need to change. - Required coverage — the domain's canonical antitheses: the counter-checks a complete answer must fetch (mirror statistics, real vs nominal, composition, the counterparty's ledger), so the agent doesn't stop at the first obvious chart.
- Ready SQL templates — tested queries against the three-table schema for the key computations (latest-month YoY, YTD comparisons, top-N drivers).
- Caveats and guardrails — unit normalization, base-year changes, national-vs-subnational traps, data gaps to disclose explicitly.
Ideas we'd love to see: labor-market health, inflation decomposition, energy markets, housing, sovereign debt, sector earnings analysis, country macro-risk snapshots.
Other welcome contributions
- Terminal renderers — new chart types or better ASCII/ANSI output in
scripts/term_chart.py(keep it stdlib-only). - Viz recipes — reusable patterns for
build_viz.pyandreferences/output/viz-guide.md. - SQL idioms and pitfalls — additions to
references/data/sql-guide.mdfrom real usage. - Docs and fixes — anything that makes the agent's first attempt land.
Test a playbook by running the questions it targets end-to-end through the skill and checking the published output; a PR description that shows a before/after share link is the most convincing review material.
No secrets belong in this repo, and the plugin holds none — all access goes through the MCP server's OAuth flow, so the coding agent holds the token and nothing is written here. All SQL runs read-only against FactIQ's data warehouse.