API 参考
DataSinking 通过一个简单的 REST API,以 Markdown 形式提供来自中国、日本、韩国和台湾的上市公司财务报告全文。选择你的接入方式: curl, Python, LLM,或 MCP server。
获取 Key 并将其作为 apikey 查询参数传入。速率限制: 免费版 1 次/秒 且 8,191 次/天 · 年度版 31 次/秒 且 131,071 次/天 + batch download。
curl
每个请求都需要携带你的 apikey。
1. 列出交易所
curl "https://api.datasink.ing/exchanges?apikey=YOUR_API_KEY"
2. 列出某个交易所的股票
# China — Shanghai curl "https://api.datasink.ing/stocks?exchange=sse&apikey=YOUR_API_KEY" # Japan — Tokyo curl "https://api.datasink.ing/stocks?exchange=jpx&apikey=YOUR_API_KEY" # Korea — KOSDAQ curl "https://api.datasink.ing/stocks?exchange=koe&apikey=YOUR_API_KEY" # Taiwan — Taipei curl "https://api.datasink.ing/stocks?exchange=twse&apikey=YOUR_API_KEY"
3. 列出某只股票的报告(元数据)
# China — Moutai (600519.SS) curl "https://api.datasink.ing/documents?symbol=600519.SS&doc_type=annual&apikey=YOUR_API_KEY" # Japan — Toyota (7203.T) curl "https://api.datasink.ing/documents?symbol=7203.T&doc_type=annual&apikey=YOUR_API_KEY" # Korea — Samsung Electronics (005930.KS) curl "https://api.datasink.ing/documents?symbol=005930.KS&doc_type=annual&apikey=YOUR_API_KEY" # Taiwan — TSMC (2330.TW) curl "https://api.datasink.ing/documents?symbol=2330.TW&doc_type=annual&apikey=YOUR_API_KEY"
4. 获取单份报告(全文)
curl "https://api.datasink.ing/documents/42?apikey=YOUR_API_KEY"
5. 获取某只股票的报告(全文)
按报告期(report_period,而非披露日期), 或通过 order=desc&size=N 获取最近 N 份:
# latest 7 (full text) curl "https://api.datasink.ing/documents?symbol=600519.SS&order=desc&size=7&with_content=1&apikey=YOUR_API_KEY" # by reporting-period range (full text) curl "https://api.datasink.ing/documents?symbol=600519.SS&report_period_from=2023-01-01&report_period_to=2023-12-31&with_content=1&apikey=YOUR_API_KEY"
6. 获取单个章节(用于 RAG)
报告按章节组织。先列出章节,然后只拉取你需要的那个章节——无需下载整份报告。例如,拉取 管理层讨论与分析(MD&A)章节,或 财务报告 以获取附注,并查找诸如 在建工程 这样的具体科目。
# list a report's sections curl "https://api.datasink.ing/documents/3/sections?apikey=YOUR_API_KEY" # pull one section only (fuzzy title match) curl "https://api.datasink.ing/documents/3?section=管理层讨论与分析&apikey=YOUR_API_KEY" # the notes (附注) live inside the financial-report chapter curl "https://api.datasink.ing/documents/3?section=财务报告&apikey=YOUR_API_KEY"
Python
pip install datasinking,然后使用五个函数:
from datasinking import DataSinking
ds = DataSinking("YOUR_API_KEY")
ds.list_exchanges() # -> ['bj', 'jpx', 'knx', 'koe', 'ksc', 'sgx', 'sse', 'szse', 'tpex', 'twse']
ds.list_stocks("sse") # -> list[dict], metadata
ds.list_reports("600519.SS", doc_type="annual") # -> list[dict], metadata (no content)
ds.get_report(42) # -> dict, single report (full text)
# -> list[dict], full text. limit: latest N, -1 = all.
ds.get_stock_reports(
"600519.SS",
period_from="2023-01-01", # by reporting period, not disclosure date
period_to="2023-12-31",
limit=7, # latest 7; -1 = all
doc_type=None,
)在 LLM 中使用
让任何 LLM 访问本站,给它你的 Key,然后用自然语言提问——模型会阅读 API、调用它,并把答案交给你。五个操作分别对应一种自然语言提问:
| “这个 API 覆盖哪些交易所?” | → list_exchanges | GET /exchanges |
| “上海交易所有哪些股票?” | → list_stocks | GET /stocks |
| “列出茅台的年报。” | → list_reports | GET /documents |
| “给我 42 号文档。” | → get_report | GET /documents/:id |
| “茅台 2023 年的营收——别把单位搞错。” | → get_stock_reports | GET /documents + with_content |
You have access to DataSinking — an API for full-text financial reports (annual,
semi-annual, quarterly) from China, Japan, Korea and Taiwan, as clean Markdown.
Docs: https://datasink.ing/docs · Spec: https://api.datasink.ing/openapi.json
My API key: YOUR_API_KEY (pass it as ?apikey=)
Workflow: list reports to get an id, then fetch by that id.
- List exchanges: GET /exchanges
- List stocks: GET /stocks?exchange=sse
- List reports: GET /documents?symbol=600519.SS&doc_type=annual
→ each item has an "id"
- Get one report: GET /documents/{id} (full Markdown)
- Get one section: GET /documents/{id}?section=管理层讨论与分析 (URL-encode non-ASCII; token-efficient for RAG)
Symbols are FMP-style: 600519.SS (Moutai), 005930.KS (Samsung), 7203.T (Toyota).
Example: "Moutai's 2023 revenue" → list reports (doc_type=annual) → find 2023 → get that
report's section 主要财务指标 → read revenue with its unit (元/RMB).返回的 content 以 YAML frontmatter 开头(身份标识 + 报告期),并会用 > 单位:元 标记单位行,这样模型就能按正确的量级读取每个数字。完整提示词见: llm-examples.md。机器可读的规范位于 https://api.datasink.ing/openapi.json。
MCP server(用于 AI Agent)
通过 Model Context Protocol 直接连接 Claude、Cursor、OpenAI Codex、DeepSeek 或任何兼容 MCP 的客户端——用自然语言提问,无需写代码。
{
"mcpServers": {
"datasinking": {
"command": "python",
"args": ["/path/to/mcp_server.py"],
"env": { "DATASINK_API_KEY": "YOUR_API_KEY" }
}
}
}工具包括 get_section——可拉取报告的单个章节(节省 token,非常适合 RAG)。完整配置指南见: mcp-server.md。
返回的字段
每个文档对象都包含以下字段(列表接口会将它们包裹在 items 中,并带有 total / page / size):
| id | int | 文档 ID —— 用于 /documents/{id} 和 batch 下载 |
| symbol | string | FMP 风格的 ticker,例如 600519.SS |
| exchange | string | sse / szse / bj / jpx / ksc / koe / knx / twse / tpex / sgx |
| stock_code | string | 6 位数字代码,例如 600519 |
| stock_name | string | 公司名称 |
| report_period | string | 报告期,YYYY-MM-DD(本报告所涵盖的会计期间) |
| doc_type | string | annual / semiannual / q1 / q3 / amendment |
| title | string | 公告标题 |
| word_count | int | Markdown 正文的字数 |
| announcement_time | int | 披露时间,以毫秒为单位的 Unix 时间戳 |
| content | string | 完整 Markdown 正文 —— 仅在 with_content=1、单份文档或 batch 下载时返回 |
content 以一段 YAML frontmatter 开头(stock_code、 stock_name、 report_period、 announcement_date、 doc_type、 title),这样 LLM 无需从正文中猜测,即可读取文档标识和报告期。
Symbol 格式
Symbol 遵循 FMP / Yahoo 的约定,因此可以直接接入现有工作流:
| 交易所 | 后缀 | 示例 |
| 上海 (SSE) | .SS | 600519.SS |
| 深圳 (SZSE) | .SZ | 000001.SZ |
| 北京 (BSE) | .BJ | 830799.BJ |
| 东京 (TSE) | .T | 7203.T |
| 韩国 (KRX) | .KS | 005930.KS |
| 台湾 (TWSE) | .TW | 2330.TW |