datasinking 0.1.0__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasinking
3
- Version: 0.1.0
4
- Summary: Python client for DataSinking — full-text China A-share financial reports as Markdown.
3
+ Version: 0.2.0
4
+ Summary: Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown.
5
5
  Author: DataSinking
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://datasink.ing
8
8
  Project-URL: Documentation, https://datasink.ing/docs
9
9
  Project-URL: Repository, https://github.com/heubme2020/datasinking
10
- Keywords: a-share,china,financial reports,markdown,api,stock
10
+ Keywords: a-share,china,korea,japan,financial reports,markdown,api,mcp,model-context-protocol,rag,llm
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
@@ -15,20 +15,23 @@ Classifier: Topic :: Office/Business :: Financial
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: requests
18
+ Provides-Extra: mcp
19
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
20
+ Requires-Dist: requests>=2.28; extra == "mcp"
19
21
  Dynamic: license-file
20
22
 
21
23
  # DataSinking
22
24
 
23
- **Full-text A-share financial reports, as clean Markdown.**
25
+ [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
24
26
 
25
- [DataSinking](https://datasink.ing) is a **China stock market data API** that serves
26
- **full-text A-share financial reports** — annual, semi-annual and quarterly — as clean
27
- **Markdown**. Download China A-share financial statements (balance sheet, income statement,
28
- cash flow) by FMP-style symbol (`600519.SS`) or filter by exchange / report period, through a
29
- simple REST API. Raw PDFs are sourced from [cninfo.com.cn](http://www.cninfo.com.cn) (the
30
- officially designated disclosure platform) and parsed into structured Markdown with YAML
31
- frontmatter, preserved headings, paragraphs and tables — ready for LLM reading and analysis.
27
+ **Full-text financial reports across Asia, as clean Markdown.**
28
+
29
+ [DataSinking](https://datasink.ing) serves **full-text financial reports** — annual, semi-annual
30
+ and quarterly — from **China, Korea and Japan** as clean **Markdown**, ready for LLM reading
31
+ and RAG. Query by FMP-style symbol (`600519.SS`, `005930.KS`, `7203.T`) or filter by exchange,
32
+ report period, or **section** — pull just the MD&A / risk section instead of the whole report.
33
+ Reports are sourced from official disclosure platforms and parsed into structured Markdown with
34
+ YAML frontmatter, preserved headings, paragraphs and tables.
32
35
 
33
36
  ---
34
37
 
@@ -40,25 +43,23 @@ Examples, research and tutorials showing how to work with financial report data,
40
43
  datasinking/
41
44
  ├── examples/ # Example scripts: pull data from the API and analyze it
42
45
  ├── research/ # Research notes / blog posts (reproducing paper-style presentation)
43
- ├── datasinking/ # Python client — pip install datasinking
44
- ├── llm-examples.md # Ask an LLM — no code needed (3 end-to-end examples)
46
+ ├── datasinking/ # Python client + MCP server — pip install "datasinking[mcp]"
47
+ ├── mcp-server.md # How to configure the MCP server (for AI agents: Claude / Cursor / Codex / DeepSeek)
48
+ ├── llm-examples.md # Ask an LLM — no code needed (8 end-to-end examples)
49
+ ├── api-examples.md # 7 examples × 3 interfaces (curl / Python / LLM)
45
50
  └── README.md
46
51
  ```
47
52
 
48
53
  ## Quick start
49
54
 
50
55
  1. Get an API key at [datasink.ing](https://datasink.ing)
51
- 2. Pull data (FMP-style `?apikey=`):
56
+ 2. One line (FMP-style `?apikey=`):
52
57
 
53
58
  ```bash
54
- # List exchanges
55
- curl "https://api.datasink.ing/exchanges?apikey=YOUR_KEY"
56
-
57
- # List all of Kweichow Moutai's reports
58
- curl "https://api.datasink.ing/documents?symbol=600519.SS&apikey=YOUR_KEY"
59
+ curl "https://api.datasink.ing/documents?symbol=600519.SS&with_content=1&apikey=YOUR_KEY"
59
60
  ```
60
61
 
61
- 3. Or use the Python client:
62
+ Or in Python:
62
63
 
63
64
  ```bash
64
65
  pip install datasinking
@@ -68,17 +69,17 @@ pip install datasinking
68
69
  from datasinking import DataSinking
69
70
 
70
71
  ds = DataSinking("YOUR_KEY")
71
-
72
- # Latest 3 reports of Kweichow Moutai (full markdown content included)
73
72
  for r in ds.get_stock_reports("600519.SS", limit=3):
74
73
  print(r["report_period"], r["title"], len(r["content"]), "chars")
75
74
  ```
76
75
 
76
+ All five functions (curl / Python / LLM): [`api-examples.md`](api-examples.md).
77
+
77
78
  ## Ask an LLM (no code)
78
79
 
79
80
  Don't want to write code? Point any LLM at [datasink.ing](https://datasink.ing),
80
81
  give it your API key, and ask in plain language. See
81
- [`llm-examples.md`](llm-examples.md) for three end-to-end examples — explore
82
+ [`llm-examples.md`](llm-examples.md) for eight end-to-end examples — explore
82
83
  coverage, list a company's reports, and extract a figure with correct units.
83
84
 
84
85
  ## Examples (`examples/`)
@@ -91,7 +92,7 @@ coverage, list a company's reports, and extract a figure with correct units.
91
92
 
92
93
  Every example pulls from the live API and runs as-is.
93
94
 
94
- > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 130k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
95
+ > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 150k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
95
96
 
96
97
  ## Research (`research/`)
97
98
 
@@ -107,16 +108,17 @@ Start from [`research/TEMPLATE.md`](research/TEMPLATE.md).
107
108
 
108
109
  | | |
109
110
  |---|---|
110
- | Coverage | SSE / SZSE / BSE, 5,000+ A-share companies |
111
+ | Coverage | China (SSE / SZSE / BSE) · Korea (KOSPI / KOSDAQ / KONEX) · Japan (TSE) |
111
112
  | Document types | annual / semiannual / q1 / q3 / amendment |
113
+ | Update frequency | Daily — Korea/Japan via official DART/EDINET APIs (new filings within ~24h of publication) |
112
114
  | Format | Full-text Markdown (with YAML frontmatter) |
113
- | API | REST — `GET /documents`, batch download, `with_content=1` for full text |
114
- | Symbols | FMP style: `600519.SS` / `000001.SZ` / `830799.BJ` |
115
+ | API | REST — `GET /documents`, batch download, `with_content=1` for full text, `?section=` + `/sections` for chapter-level access |
116
+ | Symbols | FMP style: `600519.SS` / `005930.KS` / `7203.T` |
115
117
  | Auth | `?apikey=` query parameter (FMP style) |
116
118
 
117
119
  ## Data source
118
120
 
119
- All reports originate from [cninfo.com.cn](http://www.cninfo.com.cn), the officially designated information disclosure platform of China's listed companies.
121
+ Reports are sourced from official regulatory disclosure platforms in each market and converted in-house to clean Markdown.
120
122
 
121
123
  ## License
122
124
 
@@ -1,14 +1,15 @@
1
1
  # DataSinking
2
2
 
3
- **Full-text A-share financial reports, as clean Markdown.**
3
+ [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
4
4
 
5
- [DataSinking](https://datasink.ing) is a **China stock market data API** that serves
6
- **full-text A-share financial reports** — annual, semi-annual and quarterly — as clean
7
- **Markdown**. Download China A-share financial statements (balance sheet, income statement,
8
- cash flow) by FMP-style symbol (`600519.SS`) or filter by exchange / report period, through a
9
- simple REST API. Raw PDFs are sourced from [cninfo.com.cn](http://www.cninfo.com.cn) (the
10
- officially designated disclosure platform) and parsed into structured Markdown with YAML
11
- frontmatter, preserved headings, paragraphs and tables — ready for LLM reading and analysis.
5
+ **Full-text financial reports across Asia, as clean Markdown.**
6
+
7
+ [DataSinking](https://datasink.ing) serves **full-text financial reports** — annual, semi-annual
8
+ and quarterly — from **China, Korea and Japan** as clean **Markdown**, ready for LLM reading
9
+ and RAG. Query by FMP-style symbol (`600519.SS`, `005930.KS`, `7203.T`) or filter by exchange,
10
+ report period, or **section** — pull just the MD&A / risk section instead of the whole report.
11
+ Reports are sourced from official disclosure platforms and parsed into structured Markdown with
12
+ YAML frontmatter, preserved headings, paragraphs and tables.
12
13
 
13
14
  ---
14
15
 
@@ -20,25 +21,23 @@ Examples, research and tutorials showing how to work with financial report data,
20
21
  datasinking/
21
22
  ├── examples/ # Example scripts: pull data from the API and analyze it
22
23
  ├── research/ # Research notes / blog posts (reproducing paper-style presentation)
23
- ├── datasinking/ # Python client — pip install datasinking
24
- ├── llm-examples.md # Ask an LLM — no code needed (3 end-to-end examples)
24
+ ├── datasinking/ # Python client + MCP server — pip install "datasinking[mcp]"
25
+ ├── mcp-server.md # How to configure the MCP server (for AI agents: Claude / Cursor / Codex / DeepSeek)
26
+ ├── llm-examples.md # Ask an LLM — no code needed (8 end-to-end examples)
27
+ ├── api-examples.md # 7 examples × 3 interfaces (curl / Python / LLM)
25
28
  └── README.md
26
29
  ```
27
30
 
28
31
  ## Quick start
29
32
 
30
33
  1. Get an API key at [datasink.ing](https://datasink.ing)
31
- 2. Pull data (FMP-style `?apikey=`):
34
+ 2. One line (FMP-style `?apikey=`):
32
35
 
33
36
  ```bash
34
- # List exchanges
35
- curl "https://api.datasink.ing/exchanges?apikey=YOUR_KEY"
36
-
37
- # List all of Kweichow Moutai's reports
38
- curl "https://api.datasink.ing/documents?symbol=600519.SS&apikey=YOUR_KEY"
37
+ curl "https://api.datasink.ing/documents?symbol=600519.SS&with_content=1&apikey=YOUR_KEY"
39
38
  ```
40
39
 
41
- 3. Or use the Python client:
40
+ Or in Python:
42
41
 
43
42
  ```bash
44
43
  pip install datasinking
@@ -48,17 +47,17 @@ pip install datasinking
48
47
  from datasinking import DataSinking
49
48
 
50
49
  ds = DataSinking("YOUR_KEY")
51
-
52
- # Latest 3 reports of Kweichow Moutai (full markdown content included)
53
50
  for r in ds.get_stock_reports("600519.SS", limit=3):
54
51
  print(r["report_period"], r["title"], len(r["content"]), "chars")
55
52
  ```
56
53
 
54
+ All five functions (curl / Python / LLM): [`api-examples.md`](api-examples.md).
55
+
57
56
  ## Ask an LLM (no code)
58
57
 
59
58
  Don't want to write code? Point any LLM at [datasink.ing](https://datasink.ing),
60
59
  give it your API key, and ask in plain language. See
61
- [`llm-examples.md`](llm-examples.md) for three end-to-end examples — explore
60
+ [`llm-examples.md`](llm-examples.md) for eight end-to-end examples — explore
62
61
  coverage, list a company's reports, and extract a figure with correct units.
63
62
 
64
63
  ## Examples (`examples/`)
@@ -71,7 +70,7 @@ coverage, list a company's reports, and extract a figure with correct units.
71
70
 
72
71
  Every example pulls from the live API and runs as-is.
73
72
 
74
- > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 130k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
73
+ > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 150k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
75
74
 
76
75
  ## Research (`research/`)
77
76
 
@@ -87,16 +86,17 @@ Start from [`research/TEMPLATE.md`](research/TEMPLATE.md).
87
86
 
88
87
  | | |
89
88
  |---|---|
90
- | Coverage | SSE / SZSE / BSE, 5,000+ A-share companies |
89
+ | Coverage | China (SSE / SZSE / BSE) · Korea (KOSPI / KOSDAQ / KONEX) · Japan (TSE) |
91
90
  | Document types | annual / semiannual / q1 / q3 / amendment |
91
+ | Update frequency | Daily — Korea/Japan via official DART/EDINET APIs (new filings within ~24h of publication) |
92
92
  | Format | Full-text Markdown (with YAML frontmatter) |
93
- | API | REST — `GET /documents`, batch download, `with_content=1` for full text |
94
- | Symbols | FMP style: `600519.SS` / `000001.SZ` / `830799.BJ` |
93
+ | API | REST — `GET /documents`, batch download, `with_content=1` for full text, `?section=` + `/sections` for chapter-level access |
94
+ | Symbols | FMP style: `600519.SS` / `005930.KS` / `7203.T` |
95
95
  | Auth | `?apikey=` query parameter (FMP style) |
96
96
 
97
97
  ## Data source
98
98
 
99
- All reports originate from [cninfo.com.cn](http://www.cninfo.com.cn), the officially designated information disclosure platform of China's listed companies.
99
+ Reports are sourced from official regulatory disclosure platforms in each market and converted in-house to clean Markdown.
100
100
 
101
101
  ## License
102
102
 
@@ -8,46 +8,52 @@
8
8
  get_stock_reports(symbol, ..., limit=7) 拉某股票的报告(全文)
9
9
 
10
10
  返回类型约定: list_* 一律返回 list, get_report 返回单个 dict, get_stock_reports 返回 list。
11
+
12
+ 零第三方依赖, 只用标准库 urllib。
11
13
  """
14
+ import json
12
15
  import time
13
-
14
- import requests
16
+ import urllib.request
17
+ import urllib.error
18
+ import urllib.parse
15
19
 
16
20
 
17
21
  class DataSinking:
18
22
  def __init__(self, api_key, base_url="https://api.datasink.ing"):
19
23
  self.base_url = base_url.rstrip("/")
20
24
  self.api_key = api_key
21
- self.session = requests.Session()
22
25
 
23
- # ---- 内部方法 ----
24
- def _get(self, path, params=None, retries=5):
25
- params = {**(params or {}), "apikey": self.api_key}
26
+ # ---- 内部: HTTP ----
27
+ def _request(self, method, path, params=None, body=None, retries=5):
28
+ p = dict(params or {})
29
+ p["apikey"] = self.api_key
30
+ url = f"{self.base_url}{path}?{urllib.parse.urlencode(p)}"
31
+ data = None
32
+ headers = {"User-Agent": "Mozilla/5.0 (compatible; DataSinking/0.1.0)"}
33
+ if body is not None:
34
+ data = json.dumps(body).encode("utf-8")
35
+ headers["Content-Type"] = "application/json"
36
+ req = urllib.request.Request(url, data=data, headers=headers, method=method)
37
+ last = None
26
38
  for i in range(retries):
27
39
  try:
28
- r = self.session.get(f"{self.base_url}{path}", params=params, timeout=60)
29
- if r.status_code == 429: # 限流, 稍等重试
40
+ with urllib.request.urlopen(req, timeout=60) as resp:
41
+ return json.loads(resp.read().decode("utf-8"))
42
+ except urllib.error.HTTPError as e:
43
+ if e.code == 429: # 限流, 稍等重试
30
44
  time.sleep(2)
31
45
  continue
32
- r.raise_for_status()
33
- return r.json()
34
- except (requests.exceptions.SSLError, requests.exceptions.ConnectionError):
46
+ raise # 其他 HTTP 错误(401/403/404...)直接抛给上层
47
+ except (urllib.error.URLError, TimeoutError, OSError) as e:
35
48
  time.sleep(1 + i)
36
- raise RuntimeError("Request failed after multiple retries")
49
+ last = e
50
+ raise RuntimeError(f"Request failed after retries: {last}")
37
51
 
38
- def _post(self, path, json=None, retries=5):
39
- params = {"apikey": self.api_key}
40
- for i in range(retries):
41
- try:
42
- r = self.session.post(f"{self.base_url}{path}", params=params, json=json, timeout=60)
43
- if r.status_code == 429:
44
- time.sleep(2)
45
- continue
46
- r.raise_for_status()
47
- return r.json()
48
- except (requests.exceptions.SSLError, requests.exceptions.ConnectionError):
49
- time.sleep(1 + i)
50
- raise RuntimeError("Request failed after multiple retries")
52
+ def _get(self, path, params=None):
53
+ return self._request("GET", path, params)
54
+
55
+ def _post(self, path, body=None):
56
+ return self._request("POST", path, body=body)
51
57
 
52
58
  def _fetch_all_meta(self, params):
53
59
  """分页拉全 metadata(无 content), 200/页"""
@@ -72,8 +78,8 @@ class DataSinking:
72
78
  b = self._post("/documents/batch", {"doc_ids": chunk})
73
79
  items.extend(b["items"])
74
80
  continue
75
- except requests.exceptions.HTTPError as e:
76
- if e.response is not None and e.response.status_code == 403:
81
+ except urllib.error.HTTPError as e:
82
+ if e.code == 403:
77
83
  batch_ok = False
78
84
  else:
79
85
  raise
@@ -0,0 +1,119 @@
1
+ # -*- coding: utf-8 -*-
2
+ """DataSinking MCP server (Model Context Protocol).
3
+
4
+ Expose the DataSinking API — full-text financial reports across Asia
5
+ (China, Korea, Japan) as clean Markdown — to AI agents (Claude, Cursor,
6
+ Codex, DeepSeek, Windsurf, …).
7
+
8
+ Install the MCP extra::
9
+
10
+ pip install "datasinking[mcp]"
11
+
12
+ Then run::
13
+
14
+ datasinking-mcp
15
+
16
+ or add to any MCP client with ``command: datasinking-mcp`` (stdio). Requires
17
+ the environment variable ``DATASINK_API_KEY`` (get a free key at
18
+ https://datasink.ing).
19
+ """
20
+
21
+ import os
22
+ from typing import Optional
23
+
24
+ import requests
25
+
26
+ # mcp v1 uses FastMCP; v2 renamed it to MCPServer. Support both.
27
+ try:
28
+ from mcp.server.fastmcp import FastMCP # mcp v1
29
+ except ImportError: # pragma: no cover
30
+ from mcp.server.mcpserver import MCPServer as FastMCP # mcp v2
31
+
32
+ BASE_URL = "https://api.datasink.ing"
33
+ API_KEY = os.environ.get("DATASINK_API_KEY", "")
34
+
35
+ mcp = FastMCP(
36
+ "DataSinking",
37
+ instructions=(
38
+ "DataSinking 提供亚洲(中国/韩国/日本)上市公司财报的全文 Markdown。"
39
+ "symbol 用 FMP 风格:600519.SS(茅台)、005930.KS(三星)、7203.T(丰田)。"
40
+ "要省 token 时用 get_section 只取某一章(如 MD&A),而不是 get_report 拿整篇。"
41
+ ),
42
+ )
43
+
44
+
45
+ def _get(path: str, params: Optional[dict] = None) -> dict:
46
+ """Call the DataSinking API, carrying the API key automatically."""
47
+ if not API_KEY:
48
+ raise RuntimeError("缺少 DATASINK_API_KEY 环境变量(去 datasink.ing 免费拿一个)")
49
+ p = dict(params or {})
50
+ p["apikey"] = API_KEY
51
+ r = requests.get(f"{BASE_URL}{path}", params=p, timeout=90)
52
+ r.raise_for_status()
53
+ return r.json()
54
+
55
+
56
+ @mcp.tool()
57
+ def list_exchanges() -> list:
58
+ """列出 DataSinking 覆盖的交易所代码(sse/szse/bj/ksc/koe/knx/jpx)。"""
59
+ return _get("/exchanges").get("exchanges", [])
60
+
61
+
62
+ @mcp.tool()
63
+ def list_stocks(exchange: str, limit: int = 20) -> dict:
64
+ """列出某交易所的股票(含每家公司的报告数)。
65
+
66
+ Args:
67
+ exchange: 交易所代码,如 sse / szse / ksc / koe / jpx
68
+ limit: 返回前 N 家(默认 20,防止列表过长)
69
+ """
70
+ data = _get("/stocks", {"exchange": exchange})
71
+ return {"exchange": exchange, "total": data.get("total", 0), "items": data.get("items", [])[:limit]}
72
+
73
+
74
+ @mcp.tool()
75
+ def list_reports(symbol: str, doc_type: str = "annual", size: int = 10) -> dict:
76
+ """列出某公司的报告(元数据,不含正文)。
77
+
78
+ Args:
79
+ symbol: FMP 风格代码,如 600519.SS / 005930.KS / 7203.T
80
+ doc_type: annual / semiannual / q1 / q3
81
+ size: 返回条数(默认 10)
82
+ """
83
+ return _get("/documents", {"symbol": symbol, "doc_type": doc_type, "size": size})
84
+
85
+
86
+ @mcp.tool()
87
+ def get_report(document_id: int) -> dict:
88
+ """获取单篇报告的全文(元数据 + Markdown 正文)。
89
+
90
+ Args:
91
+ document_id: 报告 ID,从 list_reports 的 items[].id 拿
92
+ """
93
+ return _get(f"/documents/{document_id}")
94
+
95
+
96
+ @mcp.tool()
97
+ def list_sections(document_id: int) -> dict:
98
+ """列出某报告的所有章节标题(供 get_section 用)。"""
99
+ return _get(f"/documents/{document_id}/sections")
100
+
101
+
102
+ @mcp.tool()
103
+ def get_section(document_id: int, section: str) -> dict:
104
+ """只取报告的某一章(省 token,适合 RAG)。
105
+
106
+ Args:
107
+ document_id: 报告 ID
108
+ section: 章节标题的关键词,如 "管理层讨论与分析" / "MD&A" / "财务报告"
109
+ """
110
+ return _get(f"/documents/{document_id}", {"section": section})
111
+
112
+
113
+ def main() -> None:
114
+ """Entry point for the ``datasinking-mcp`` console script."""
115
+ mcp.run()
116
+
117
+
118
+ if __name__ == "__main__":
119
+ main()
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datasinking
3
- Version: 0.1.0
4
- Summary: Python client for DataSinking — full-text China A-share financial reports as Markdown.
3
+ Version: 0.2.0
4
+ Summary: Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown.
5
5
  Author: DataSinking
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://datasink.ing
8
8
  Project-URL: Documentation, https://datasink.ing/docs
9
9
  Project-URL: Repository, https://github.com/heubme2020/datasinking
10
- Keywords: a-share,china,financial reports,markdown,api,stock
10
+ Keywords: a-share,china,korea,japan,financial reports,markdown,api,mcp,model-context-protocol,rag,llm
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
@@ -15,20 +15,23 @@ Classifier: Topic :: Office/Business :: Financial
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: requests
18
+ Provides-Extra: mcp
19
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
20
+ Requires-Dist: requests>=2.28; extra == "mcp"
19
21
  Dynamic: license-file
20
22
 
21
23
  # DataSinking
22
24
 
23
- **Full-text A-share financial reports, as clean Markdown.**
25
+ [![PyPI version](https://img.shields.io/pypi/v/datasinking.svg)](https://pypi.org/project/datasinking/)
24
26
 
25
- [DataSinking](https://datasink.ing) is a **China stock market data API** that serves
26
- **full-text A-share financial reports** — annual, semi-annual and quarterly — as clean
27
- **Markdown**. Download China A-share financial statements (balance sheet, income statement,
28
- cash flow) by FMP-style symbol (`600519.SS`) or filter by exchange / report period, through a
29
- simple REST API. Raw PDFs are sourced from [cninfo.com.cn](http://www.cninfo.com.cn) (the
30
- officially designated disclosure platform) and parsed into structured Markdown with YAML
31
- frontmatter, preserved headings, paragraphs and tables — ready for LLM reading and analysis.
27
+ **Full-text financial reports across Asia, as clean Markdown.**
28
+
29
+ [DataSinking](https://datasink.ing) serves **full-text financial reports** — annual, semi-annual
30
+ and quarterly — from **China, Korea and Japan** as clean **Markdown**, ready for LLM reading
31
+ and RAG. Query by FMP-style symbol (`600519.SS`, `005930.KS`, `7203.T`) or filter by exchange,
32
+ report period, or **section** — pull just the MD&A / risk section instead of the whole report.
33
+ Reports are sourced from official disclosure platforms and parsed into structured Markdown with
34
+ YAML frontmatter, preserved headings, paragraphs and tables.
32
35
 
33
36
  ---
34
37
 
@@ -40,25 +43,23 @@ Examples, research and tutorials showing how to work with financial report data,
40
43
  datasinking/
41
44
  ├── examples/ # Example scripts: pull data from the API and analyze it
42
45
  ├── research/ # Research notes / blog posts (reproducing paper-style presentation)
43
- ├── datasinking/ # Python client — pip install datasinking
44
- ├── llm-examples.md # Ask an LLM — no code needed (3 end-to-end examples)
46
+ ├── datasinking/ # Python client + MCP server — pip install "datasinking[mcp]"
47
+ ├── mcp-server.md # How to configure the MCP server (for AI agents: Claude / Cursor / Codex / DeepSeek)
48
+ ├── llm-examples.md # Ask an LLM — no code needed (8 end-to-end examples)
49
+ ├── api-examples.md # 7 examples × 3 interfaces (curl / Python / LLM)
45
50
  └── README.md
46
51
  ```
47
52
 
48
53
  ## Quick start
49
54
 
50
55
  1. Get an API key at [datasink.ing](https://datasink.ing)
51
- 2. Pull data (FMP-style `?apikey=`):
56
+ 2. One line (FMP-style `?apikey=`):
52
57
 
53
58
  ```bash
54
- # List exchanges
55
- curl "https://api.datasink.ing/exchanges?apikey=YOUR_KEY"
56
-
57
- # List all of Kweichow Moutai's reports
58
- curl "https://api.datasink.ing/documents?symbol=600519.SS&apikey=YOUR_KEY"
59
+ curl "https://api.datasink.ing/documents?symbol=600519.SS&with_content=1&apikey=YOUR_KEY"
59
60
  ```
60
61
 
61
- 3. Or use the Python client:
62
+ Or in Python:
62
63
 
63
64
  ```bash
64
65
  pip install datasinking
@@ -68,17 +69,17 @@ pip install datasinking
68
69
  from datasinking import DataSinking
69
70
 
70
71
  ds = DataSinking("YOUR_KEY")
71
-
72
- # Latest 3 reports of Kweichow Moutai (full markdown content included)
73
72
  for r in ds.get_stock_reports("600519.SS", limit=3):
74
73
  print(r["report_period"], r["title"], len(r["content"]), "chars")
75
74
  ```
76
75
 
76
+ All five functions (curl / Python / LLM): [`api-examples.md`](api-examples.md).
77
+
77
78
  ## Ask an LLM (no code)
78
79
 
79
80
  Don't want to write code? Point any LLM at [datasink.ing](https://datasink.ing),
80
81
  give it your API key, and ask in plain language. See
81
- [`llm-examples.md`](llm-examples.md) for three end-to-end examples — explore
82
+ [`llm-examples.md`](llm-examples.md) for eight end-to-end examples — explore
82
83
  coverage, list a company's reports, and extract a figure with correct units.
83
84
 
84
85
  ## Examples (`examples/`)
@@ -91,7 +92,7 @@ coverage, list a company's reports, and extract a figure with correct units.
91
92
 
92
93
  Every example pulls from the live API and runs as-is.
93
94
 
94
- > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 130k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
95
+ > `03_download_exchange.py` fetches every report on an exchange (e.g. all of Shenzhen — 150k+ documents). Free keys work too, but fall back to slow per-document fetching (1 req/s + shared daily quota); a **paid (yearly)** key is strongly recommended for full-exchange downloads.
95
96
 
96
97
  ## Research (`research/`)
97
98
 
@@ -107,16 +108,17 @@ Start from [`research/TEMPLATE.md`](research/TEMPLATE.md).
107
108
 
108
109
  | | |
109
110
  |---|---|
110
- | Coverage | SSE / SZSE / BSE, 5,000+ A-share companies |
111
+ | Coverage | China (SSE / SZSE / BSE) · Korea (KOSPI / KOSDAQ / KONEX) · Japan (TSE) |
111
112
  | Document types | annual / semiannual / q1 / q3 / amendment |
113
+ | Update frequency | Daily — Korea/Japan via official DART/EDINET APIs (new filings within ~24h of publication) |
112
114
  | Format | Full-text Markdown (with YAML frontmatter) |
113
- | API | REST — `GET /documents`, batch download, `with_content=1` for full text |
114
- | Symbols | FMP style: `600519.SS` / `000001.SZ` / `830799.BJ` |
115
+ | API | REST — `GET /documents`, batch download, `with_content=1` for full text, `?section=` + `/sections` for chapter-level access |
116
+ | Symbols | FMP style: `600519.SS` / `005930.KS` / `7203.T` |
115
117
  | Auth | `?apikey=` query parameter (FMP style) |
116
118
 
117
119
  ## Data source
118
120
 
119
- All reports originate from [cninfo.com.cn](http://www.cninfo.com.cn), the officially designated information disclosure platform of China's listed companies.
121
+ Reports are sourced from official regulatory disclosure platforms in each market and converted in-house to clean Markdown.
120
122
 
121
123
  ## License
122
124
 
@@ -3,8 +3,10 @@ README.md
3
3
  pyproject.toml
4
4
  datasinking/__init__.py
5
5
  datasinking/client.py
6
+ datasinking/mcp_server.py
6
7
  datasinking.egg-info/PKG-INFO
7
8
  datasinking.egg-info/SOURCES.txt
8
9
  datasinking.egg-info/dependency_links.txt
10
+ datasinking.egg-info/entry_points.txt
9
11
  datasinking.egg-info/requires.txt
10
12
  datasinking.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ datasinking-mcp = datasinking.mcp_server:main
@@ -0,0 +1,4 @@
1
+
2
+ [mcp]
3
+ mcp>=1.0.0
4
+ requests>=2.28
@@ -4,20 +4,26 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "datasinking"
7
- version = "0.1.0"
8
- description = "Python client for DataSinking — full-text China A-share financial reports as Markdown."
7
+ version = "0.2.0"
8
+ description = "Python client for DataSinking — full-text Asian financial reports (China, Korea, Japan) as Markdown."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
11
11
  license = { text = "MIT" }
12
12
  authors = [{ name = "DataSinking" }]
13
- keywords = ["a-share", "china", "financial reports", "markdown", "api", "stock"]
13
+ keywords = ["a-share", "china", "korea", "japan", "financial reports", "markdown", "api", "mcp", "model-context-protocol", "rag", "llm"]
14
14
  classifiers = [
15
15
  "Programming Language :: Python :: 3",
16
16
  "License :: OSI Approved :: MIT License",
17
17
  "Operating System :: OS Independent",
18
18
  "Topic :: Office/Business :: Financial",
19
19
  ]
20
- dependencies = ["requests"]
20
+ dependencies = []
21
+
22
+ [project.optional-dependencies]
23
+ mcp = ["mcp>=1.0.0", "requests>=2.28"]
24
+
25
+ [project.scripts]
26
+ datasinking-mcp = "datasinking.mcp_server:main"
21
27
 
22
28
  [project.urls]
23
29
  Homepage = "https://datasink.ing"
@@ -1 +0,0 @@
1
- requests
File without changes
File without changes