tdxdata 0.2.0__tar.gz → 0.2.2__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.
- {tdxdata-0.2.0/src/tdxdata.egg-info → tdxdata-0.2.2}/PKG-INFO +1 -1
- {tdxdata-0.2.0 → tdxdata-0.2.2}/pyproject.toml +1 -1
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/__init__.py +1 -1
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/commands/finance.py +3 -1
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/pool2.py +16 -3
- {tdxdata-0.2.0 → tdxdata-0.2.2/src/tdxdata.egg-info}/PKG-INFO +1 -1
- {tdxdata-0.2.0 → tdxdata-0.2.2}/LICENSE +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/NOTICE.md +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/README.md +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/setup.cfg +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/cli.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/client.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/commands/__init__.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/commands/auth.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/commands/bars.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/commands/quotes.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/protocol.py +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata/servers.txt +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata.egg-info/SOURCES.txt +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata.egg-info/dependency_links.txt +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata.egg-info/entry_points.txt +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/src/tdxdata.egg-info/top_level.txt +0 -0
- {tdxdata-0.2.0 → tdxdata-0.2.2}/tests/test_finance_pool.py +0 -0
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
from .client import TdxClient, market_of, parse_snap
|
|
12
12
|
from .pool2 import Pool # 0.2.0: 顶层导出并发池(含 finance_all),否则 import tdxdata; tdxdata.Pool 不可见
|
|
13
13
|
|
|
14
|
-
__version__ = "0.2.
|
|
14
|
+
__version__ = "0.2.2" # ponytail: 与 pyproject.toml 手工同步;tests 里有漂移断言兜底
|
|
15
15
|
__all__ = ["TdxClient", "Pool", "market_of", "parse_snap", "__version__"]
|
|
@@ -54,7 +54,9 @@ def parse_finance(resp: bytes) -> dict:
|
|
|
54
54
|
else: # 金额类: 千元 → 元
|
|
55
55
|
rest[FIELDS[i]] = round(v * 1000, 2)
|
|
56
56
|
return {
|
|
57
|
-
|
|
57
|
+
# 退市/无效票会返回"全零空壳"(code 全是 \x00、ipo_date=0):
|
|
58
|
+
# 只看帧长度会误判成功,调用方拿到一堆 0 却以为有数据 → 必须按内容判 ok
|
|
59
|
+
'ok': bool(code.strip('\x00')) and ipo > 0, 'code': code, 'market': market,
|
|
58
60
|
'liutongguben': liutong, # 股
|
|
59
61
|
'zongguben': zongguben, # 股
|
|
60
62
|
'province': prov, 'industry': ind,
|
|
@@ -85,7 +85,12 @@ class Conn:
|
|
|
85
85
|
pass
|
|
86
86
|
|
|
87
87
|
def worker(host, codes, results, idx):
|
|
88
|
-
|
|
88
|
+
"""单连接顺序拉快照。建连失败时整块按失败回填,不炸线程(同 worker_finance)。"""
|
|
89
|
+
try:
|
|
90
|
+
c = Conn(host)
|
|
91
|
+
except Exception:
|
|
92
|
+
results[idx] = [(code, None, False) for code in codes]
|
|
93
|
+
return
|
|
89
94
|
mine = []
|
|
90
95
|
for code in codes:
|
|
91
96
|
m = 1 if code.startswith(('5', '6', '9')) else 0 # 5=沪基金 6=沪A 9=沪B
|
|
@@ -99,8 +104,16 @@ def worker(host, codes, results, idx):
|
|
|
99
104
|
|
|
100
105
|
|
|
101
106
|
def worker_finance(host, codes, results, idx):
|
|
102
|
-
"""单连接顺序拉财务(照 worker
|
|
103
|
-
|
|
107
|
+
"""单连接顺序拉财务(照 worker 的模式)。
|
|
108
|
+
|
|
109
|
+
建连失败时**不炸线程**:整块按失败回填,避免一条线程崩掉导致
|
|
110
|
+
它分到的所有代码静默丢失(2026-10-28 实测:400 只只回 66 只即此因)。
|
|
111
|
+
"""
|
|
112
|
+
try:
|
|
113
|
+
c = Conn(host)
|
|
114
|
+
except Exception:
|
|
115
|
+
results[idx] = [(code, {'ok': False, 'code': code}) for code in codes]
|
|
116
|
+
return
|
|
104
117
|
mine = []
|
|
105
118
|
for code in codes:
|
|
106
119
|
m = 1 if code.startswith(('5', '6', '9')) else 0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|