zsdtdx 0.1.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.
Files changed (58) hide show
  1. zsdtdx-0.1.0/LICENSE +21 -0
  2. zsdtdx-0.1.0/MANIFEST.in +6 -0
  3. zsdtdx-0.1.0/PKG-INFO +98 -0
  4. zsdtdx-0.1.0/README.md +79 -0
  5. zsdtdx-0.1.0/THIRD_PARTY_NOTICES.md +24 -0
  6. zsdtdx-0.1.0/pyproject.toml +35 -0
  7. zsdtdx-0.1.0/setup.cfg +4 -0
  8. zsdtdx-0.1.0/src/zsdtdx/__init__.py +38 -0
  9. zsdtdx-0.1.0/src/zsdtdx/base_socket_client.py +466 -0
  10. zsdtdx-0.1.0/src/zsdtdx/config.yaml +201 -0
  11. zsdtdx-0.1.0/src/zsdtdx/errors.py +44 -0
  12. zsdtdx-0.1.0/src/zsdtdx/exhq.py +322 -0
  13. zsdtdx-0.1.0/src/zsdtdx/heartbeat.py +70 -0
  14. zsdtdx-0.1.0/src/zsdtdx/helper.py +201 -0
  15. zsdtdx-0.1.0/src/zsdtdx/hq.py +494 -0
  16. zsdtdx-0.1.0/src/zsdtdx/log.py +35 -0
  17. zsdtdx-0.1.0/src/zsdtdx/parallel_fetcher.py +1510 -0
  18. zsdtdx-0.1.0/src/zsdtdx/params.py +64 -0
  19. zsdtdx-0.1.0/src/zsdtdx/parser/__init__.py +12 -0
  20. zsdtdx-0.1.0/src/zsdtdx/parser/base.py +223 -0
  21. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_history_instrument_bars_range.py +190 -0
  22. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_history_minute_time_data.py +88 -0
  23. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_history_transaction_data.py +169 -0
  24. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_instrument_bars.py +152 -0
  25. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_instrument_count.py +52 -0
  26. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_instrument_info.py +99 -0
  27. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_instrument_quote.py +179 -0
  28. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_instrument_quote_list.py +243 -0
  29. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_markets.py +77 -0
  30. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_minute_time_data.py +90 -0
  31. zsdtdx-0.1.0/src/zsdtdx/parser/ex_get_transaction_data.py +160 -0
  32. zsdtdx-0.1.0/src/zsdtdx/parser/ex_setup_commands.py +51 -0
  33. zsdtdx-0.1.0/src/zsdtdx/parser/get_company_info_category.py +108 -0
  34. zsdtdx-0.1.0/src/zsdtdx/parser/get_company_info_content.py +71 -0
  35. zsdtdx-0.1.0/src/zsdtdx/parser/get_finance_info.py +180 -0
  36. zsdtdx-0.1.0/src/zsdtdx/parser/get_history_minute_time_data.py +74 -0
  37. zsdtdx-0.1.0/src/zsdtdx/parser/get_history_transaction_data.py +103 -0
  38. zsdtdx-0.1.0/src/zsdtdx/parser/get_index_bars.py +165 -0
  39. zsdtdx-0.1.0/src/zsdtdx/parser/get_minute_time_data.py +112 -0
  40. zsdtdx-0.1.0/src/zsdtdx/parser/get_report_file.py +77 -0
  41. zsdtdx-0.1.0/src/zsdtdx/parser/get_security_bars.py +152 -0
  42. zsdtdx-0.1.0/src/zsdtdx/parser/get_security_count.py +78 -0
  43. zsdtdx-0.1.0/src/zsdtdx/parser/get_security_list.py +89 -0
  44. zsdtdx-0.1.0/src/zsdtdx/parser/get_security_quotes.py +245 -0
  45. zsdtdx-0.1.0/src/zsdtdx/parser/get_transaction_data.py +91 -0
  46. zsdtdx-0.1.0/src/zsdtdx/parser/get_xdxr_info.py +223 -0
  47. zsdtdx-0.1.0/src/zsdtdx/parser/raw_parser.py +47 -0
  48. zsdtdx-0.1.0/src/zsdtdx/parser/setup_commands.py +105 -0
  49. zsdtdx-0.1.0/src/zsdtdx/simple_api.py +643 -0
  50. zsdtdx-0.1.0/src/zsdtdx/warmup.py +122 -0
  51. zsdtdx-0.1.0/src/zsdtdx/wrapper/__init__.py +5 -0
  52. zsdtdx-0.1.0/src/zsdtdx/wrapper/network_policy.py +53 -0
  53. zsdtdx-0.1.0/src/zsdtdx/wrapper/unified_client.py +2087 -0
  54. zsdtdx-0.1.0/src/zsdtdx.egg-info/PKG-INFO +98 -0
  55. zsdtdx-0.1.0/src/zsdtdx.egg-info/SOURCES.txt +56 -0
  56. zsdtdx-0.1.0/src/zsdtdx.egg-info/dependency_links.txt +1 -0
  57. zsdtdx-0.1.0/src/zsdtdx.egg-info/requires.txt +4 -0
  58. zsdtdx-0.1.0/src/zsdtdx.egg-info/top_level.txt +1 -0
zsdtdx-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 sida
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ include THIRD_PARTY_NOTICES.md
4
+ recursive-include src/zsdtdx *.yaml
5
+ global-exclude __pycache__
6
+ global-exclude *.py[cod]
zsdtdx-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,98 @@
1
+ Metadata-Version: 2.4
2
+ Name: zsdtdx
3
+ Version: 0.1.0
4
+ Summary: Unified wrapper around pytdx-style market data APIs.
5
+ License-Expression: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.10
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: pandas
15
+ Requires-Dist: PyYAML
16
+ Requires-Dist: six
17
+ Requires-Dist: psutil
18
+ Dynamic: license-file
19
+
20
+ # zsdtdx
21
+
22
+ `zsdtdx` 是一个面向 A 股/期货行情场景的 Python 封装库,基于 pytdx 体系做统一 API、连接池、重试与并行抓取增强,目标是提供更稳定的一致化数据接口。
23
+
24
+ ## 安装
25
+
26
+ ```bash
27
+ pip install zsdtdx
28
+ ```
29
+
30
+ ## 快速开始
31
+
32
+ ```python
33
+ import queue as py_queue
34
+ from zsdtdx import StockKlineTask, get_client, get_stock_kline, get_stock_latest_price
35
+
36
+ with get_client() as client:
37
+ prices = get_stock_latest_price(["600000", "000001"])
38
+
39
+ q = py_queue.Queue()
40
+ payloads = get_stock_kline(
41
+ task=[
42
+ StockKlineTask(code="600000", freq="d", start_time="2026-02-01", end_time="2026-02-14"),
43
+ {"code": "000001", "freq": "60", "start_time": "2026-02-01", "end_time": "2026-02-14"},
44
+ ],
45
+ queue=q,
46
+ mode="sync",
47
+ )
48
+
49
+ print(prices)
50
+ print(len(payloads))
51
+ ```
52
+
53
+ ## 配置说明
54
+
55
+ - 默认情况下,`get_client()` 会读取包内置的 `config.yaml`。
56
+ - 你可以按需传入自定义配置路径:
57
+
58
+ ```python
59
+ from zsdtdx import get_client
60
+
61
+ with get_client(config_path=r"D:\\configs\\zsdtdx.yaml") as client:
62
+ ...
63
+ ```
64
+
65
+ - 时间窗口按左闭右开 `[start_time, end_time)` 解释。
66
+ - `get_stock_kline` 只接受 `task` 列表输入(`StockKlineTask` 或 `dict`)。
67
+
68
+ ## API 概览
69
+
70
+ - `get_client`
71
+ - `get_supported_markets`
72
+ - `get_stock_code_name`
73
+ - `get_all_future_list`
74
+ - `get_stock_kline`
75
+ - `get_future_kline`
76
+ - `get_company_info`
77
+ - `get_stock_latest_price`
78
+ - `get_future_latest_price`
79
+ - `get_runtime_failures`
80
+ - `get_runtime_metadata`
81
+
82
+ ## 运行环境与依赖
83
+
84
+ - Python: `>=3.10`
85
+ - 依赖:`pandas`、`PyYAML`、`six`、`psutil`
86
+
87
+ ## 开发文档
88
+
89
+ 以下文档用于开发维护,不作为对外安装说明主文档:
90
+
91
+ - `HANDOFF.md`
92
+ - `PERFORMANCE_REPORT.md`
93
+ - `examples/`
94
+
95
+ ## 许可证与来源
96
+
97
+ - 本项目以 MIT 许可证发布,见 `LICENSE`。
98
+ - 本项目基于 `pytdx` 生态进行改写与扩展,归属说明见 `THIRD_PARTY_NOTICES.md`。
zsdtdx-0.1.0/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # zsdtdx
2
+
3
+ `zsdtdx` 是一个面向 A 股/期货行情场景的 Python 封装库,基于 pytdx 体系做统一 API、连接池、重试与并行抓取增强,目标是提供更稳定的一致化数据接口。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pip install zsdtdx
9
+ ```
10
+
11
+ ## 快速开始
12
+
13
+ ```python
14
+ import queue as py_queue
15
+ from zsdtdx import StockKlineTask, get_client, get_stock_kline, get_stock_latest_price
16
+
17
+ with get_client() as client:
18
+ prices = get_stock_latest_price(["600000", "000001"])
19
+
20
+ q = py_queue.Queue()
21
+ payloads = get_stock_kline(
22
+ task=[
23
+ StockKlineTask(code="600000", freq="d", start_time="2026-02-01", end_time="2026-02-14"),
24
+ {"code": "000001", "freq": "60", "start_time": "2026-02-01", "end_time": "2026-02-14"},
25
+ ],
26
+ queue=q,
27
+ mode="sync",
28
+ )
29
+
30
+ print(prices)
31
+ print(len(payloads))
32
+ ```
33
+
34
+ ## 配置说明
35
+
36
+ - 默认情况下,`get_client()` 会读取包内置的 `config.yaml`。
37
+ - 你可以按需传入自定义配置路径:
38
+
39
+ ```python
40
+ from zsdtdx import get_client
41
+
42
+ with get_client(config_path=r"D:\\configs\\zsdtdx.yaml") as client:
43
+ ...
44
+ ```
45
+
46
+ - 时间窗口按左闭右开 `[start_time, end_time)` 解释。
47
+ - `get_stock_kline` 只接受 `task` 列表输入(`StockKlineTask` 或 `dict`)。
48
+
49
+ ## API 概览
50
+
51
+ - `get_client`
52
+ - `get_supported_markets`
53
+ - `get_stock_code_name`
54
+ - `get_all_future_list`
55
+ - `get_stock_kline`
56
+ - `get_future_kline`
57
+ - `get_company_info`
58
+ - `get_stock_latest_price`
59
+ - `get_future_latest_price`
60
+ - `get_runtime_failures`
61
+ - `get_runtime_metadata`
62
+
63
+ ## 运行环境与依赖
64
+
65
+ - Python: `>=3.10`
66
+ - 依赖:`pandas`、`PyYAML`、`six`、`psutil`
67
+
68
+ ## 开发文档
69
+
70
+ 以下文档用于开发维护,不作为对外安装说明主文档:
71
+
72
+ - `HANDOFF.md`
73
+ - `PERFORMANCE_REPORT.md`
74
+ - `examples/`
75
+
76
+ ## 许可证与来源
77
+
78
+ - 本项目以 MIT 许可证发布,见 `LICENSE`。
79
+ - 本项目基于 `pytdx` 生态进行改写与扩展,归属说明见 `THIRD_PARTY_NOTICES.md`。
@@ -0,0 +1,24 @@
1
+ # Third-Party Notices
2
+
3
+ This project (`zsdtdx`) is developed with reference to and partial adaptation of
4
+ the upstream project:
5
+
6
+ - Project: `pytdx`
7
+ - Homepage: <https://github.com/rainx/pytdx>
8
+ - PyPI: <https://pypi.org/project/pytdx/>
9
+
10
+ ## Attribution
11
+
12
+ Portions of protocol parsing and API behavior are derived from or inspired by
13
+ `pytdx`, with additional wrapper, retry, routing, batching, and parallel-fetch
14
+ logic implemented in this project.
15
+
16
+ ## License Status Note
17
+
18
+ During packaging preparation, the `pytdx` 1.72 source distribution metadata on
19
+ PyPI reports `License: UNKNOWN`, and the source archive does not contain a
20
+ standalone `LICENSE` file.
21
+
22
+ Before public distribution, maintainers should verify the upstream license terms
23
+ from the authoritative upstream repository and retain any required notices in
24
+ this file.
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "zsdtdx"
7
+ version = "0.1.0"
8
+ description = "Unified wrapper around pytdx-style market data APIs."
9
+ readme = { file = "README.md", content-type = "text/markdown" }
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ dependencies = [
13
+ "pandas",
14
+ "PyYAML",
15
+ "six",
16
+ "psutil",
17
+ ]
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ [tool.setuptools]
27
+ package-dir = { "" = "src" }
28
+ include-package-data = true
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
32
+ include = ["zsdtdx*"]
33
+
34
+ [tool.setuptools.package-data]
35
+ zsdtdx = ["config.yaml"]
zsdtdx-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ """zsdtdx 对外导出入口。"""
2
+
3
+ from zsdtdx.simple_api import (
4
+ StockKlineTask,
5
+ get_all_future_list,
6
+ get_client,
7
+ get_company_info,
8
+ get_future_kline,
9
+ get_future_latest_price,
10
+ get_runtime_failures,
11
+ get_runtime_metadata,
12
+ get_stock_code_name,
13
+ get_stock_kline,
14
+ get_stock_latest_price,
15
+ get_supported_markets,
16
+ )
17
+ from zsdtdx.parallel_fetcher import StockKlineJob
18
+ from zsdtdx.wrapper.unified_client import UnifiedTdxClient
19
+
20
+ __version__ = "0.1.0"
21
+
22
+ __all__ = [
23
+ "__version__",
24
+ "UnifiedTdxClient",
25
+ "StockKlineTask",
26
+ "StockKlineJob",
27
+ "get_client",
28
+ "get_supported_markets",
29
+ "get_stock_code_name",
30
+ "get_all_future_list",
31
+ "get_stock_kline",
32
+ "get_future_kline",
33
+ "get_company_info",
34
+ "get_stock_latest_price",
35
+ "get_future_latest_price",
36
+ "get_runtime_failures",
37
+ "get_runtime_metadata",
38
+ ]