API 參考文件
DataSinking 透過簡潔的 REST API,以 Markdown 提供中國、日本、韓國與台灣的全文財報。選擇你的使用介面: curl, Python, LLM,或 MCP server。
取得金鑰 並以 apikey 查詢參數傳入。速率限制: 免費方案 1 req/s & 8,191 req/day · 年繳方案 31 req/s & 131,071 req/day + 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 指向本網站,提供你的金鑰,用自然語言提問——模型會讀取 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} 與批次下載 |
| 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、單一文件或批次下載時提供 |
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 |