通达信 EX 通道对美股返回的分钟级 K线把两个时区拼进同一个五元组:日期分量是 美东交易日(zipday),时分分量是北京时间(tminutes)。直拼出的 datetime 会把 同一交易日的下午半场排到上午半场之前——单日 390 根首末颠倒,且全部落在同一个 北京自然日里,导致排序 / count 切片 / 日期区间二分与过滤 / 增量水位线全部不可用。 在 SecurityBar.__post_init__ 统一归一化为北京时间(凌晨段日期 +1 天,含月末与 年末进位),EX 的两条 K线命令路径(_bars_ex 的 0x23FF 与二分所依赖的 MAC 0x122E) 因此共用同一口径,不会出现"取数按一套时间、二分按另一套时间"的错位。 新增两个只读属性:trading_date(归属交易日;美股一个交易日横跨两个北京自然日, 按交易日聚合必须用它,不能用 datetime.date())与 is_us。 实测(安装 wheel 0.6.2,非源码树):10-06 ~ 10-12 五个完整交易日各 390 根、 严格单调,首根 open / 末根 close 与日线逐位相同,成交量差 <= 1;A股 / 港股零回归。 - 版本 0.6.1 -> 0.6.2(pyproject / __init__ / uv.lock) - tests/test_protocol.py 新增 9 项回归测试(分界点 / 月末年末进位 / 390 根整日单调性 / MAC 路径),全量 191 passed - CHANGELOG / README / SKILL.md / docs(faq、llms.txt、api/models)同步口径说明 遗留(本版未含,待决策):EX 分时对美股返回的 MinuteBar.hour 是未取模的连续分钟数 (实测可达 27,即次日 03:xx),且 MinuteBar 无日期分量可承载跨日信息。 Co-authored-by: openbot-coder <openbot-coder@users.noreply.github.com>
63 lines
1.7 KiB
TOML
63 lines
1.7 KiB
TOML
[project]
|
|
name = "pytdxdata"
|
|
version = "0.6.2"
|
|
description = "通达信(TongDaXin)行情数据客户端:动态连接池 + 双层TTL缓存 + 3连接并发分页,纯asyncio零运行时依赖,支持A股/港股/美股/期货/期权"
|
|
readme = "README.md"
|
|
requires-python = ">=3.11"
|
|
license = "MIT"
|
|
license-files = ["LICENSE"]
|
|
keywords = ["tdx", "trading", "stock", "kline", "quote", "通达信", "A股", "港股", "美股", "期货", "asyncio", "quant"]
|
|
authors = [
|
|
{ name = "openbot-coder", email = "openbot-coder@users.noreply.github.com" }
|
|
]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Intended Audience :: Developers",
|
|
"Intended Audience :: Financial and Insurance Industry",
|
|
"Topic :: Office/Business :: Financial :: Investment",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Operating System :: OS Independent",
|
|
"Framework :: AsyncIO",
|
|
"Typing :: Typed",
|
|
]
|
|
dependencies = []
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/openbot-coder/pytdxdata"
|
|
Repository = "https://github.com/openbot-coder/pytdxdata"
|
|
Documentation = "https://openbot-coder.github.io/pytdxdata/"
|
|
|
|
[project.optional-dependencies]
|
|
uvloop = ["uvloop>=0.21"]
|
|
dev = ["pytest>=8.0", "pytest-asyncio>=0.24", "ruff>=0.6"]
|
|
|
|
[project.scripts]
|
|
tdx = "pytdxdata.cli:main"
|
|
|
|
[build-system]
|
|
requires = ["uv_build>=0.11.1,<0.12.0"]
|
|
build-backend = "uv_build"
|
|
|
|
[tool.ruff]
|
|
line-length = 100
|
|
target-version = "py313"
|
|
|
|
[tool.pytest.ini_options]
|
|
asyncio_mode = "auto"
|
|
testpaths = ["tests"]
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"pytest>=9.1.1",
|
|
"pytest-asyncio>=1.4.0",
|
|
]
|
|
docs = [
|
|
"mkdocs-material>=9.5",
|
|
"mkdocstrings[python]>=0.26",
|
|
"ruff>=0.6",
|
|
"jieba>=0.42",
|
|
]
|
|
|