mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 16:54:20 +08:00
MacExClient.goods_transaction 此前对所有扩展市场统一复用 A 股 MAC 协议的
SymbolTransactionCmd(0x122F),但 0x122F 数据源未接入港股,服务器对港股
market 一律返回 39 字节空响应(count=0)。
港股股票类市场(HK_STOCK_MARKETS = {27,31,48,49,71,98})改走 ex 扩展行情
协议:query_date=None → GetExTransactionDataCmd(0x23FC 当日),指定日期 →
GetExHistoryTransactionDataCmd(0x2406 历史)。返回的 ExTransactionRecord
(price 为整数、单位 0.001 HKD)映射为与 A 股 MacTransaction 一致的 schema,
价格 ÷1000 换算为港元浮点,与港股分时图 float 价格对齐。count > 1800 时按
1800/页自动分页。其余扩展市场(美股 / 期货等)保持 MAC 0x122F 路径不变。
新增 src/easy_tdx/ex/_hk_transaction.py(市场判定 + 字段映射 + 自动分页,
同步/异步共用);回归测试 24 例(tests/unit/test_hk_transaction.py)+ 真实
fixture(港股 00700 在 2026-07-03 的 0x2406 响应)。862 单测全绿,ruff /
mypy strict 通过。
68 lines
1.9 KiB
TOML
68 lines
1.9 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "easy-tdx"
|
|
version = "1.17.5"
|
|
description = "通达信 TCP 协议行情数据客户端,支持在线行情、离线数据读取与写入同步"
|
|
readme = "README.md"
|
|
requires-python = ">=3.10"
|
|
dependencies = ["pandas>=2.0,<3", "tzdata>=2024.1", "click>=8.0,<9"]
|
|
|
|
[project.scripts]
|
|
easy-tdx = "easy_tdx.cli:cli" # cli/__init__.py exposes the click group
|
|
|
|
[project.optional-dependencies]
|
|
dev = ["pytest>=8.0", "pytest-asyncio>=0.23", "pytest-cov", "mypy>=1.9", "ruff>=0.4", "scipy>=1.10,<1.16", "httpx>=0.27"]
|
|
science = ["scipy>=1.10,<1.16"]
|
|
web = ["fastapi>=0.110,<1", "uvicorn[standard]>=0.29"]
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/easy_tdx"]
|
|
|
|
[tool.mypy]
|
|
strict = true
|
|
python_version = "3.12"
|
|
# 跳过未跟踪的本地脚本(依赖外部 unified_config/sqlalchemy/requests,不属于库)
|
|
exclude = ["src/easy_tdx/exchange_margin\\.py"]
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = ["pandas", "tabulate", "matplotlib", "matplotlib.*"]
|
|
ignore_missing_imports = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = "easy_tdx.MyTT"
|
|
# Type stubs provided via MyTT.pyi — keep strict checks enabled
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = ["fastapi.*", "uvicorn.*", "pydantic.*"]
|
|
ignore_missing_imports = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = ["scipy", "scipy.*"]
|
|
ignore_missing_imports = true
|
|
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 100
|
|
extend-exclude = ["*.pyi", "src/easy_tdx/exchange_margin.py"]
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "UP"]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests"]
|
|
addopts = "--tb=short"
|
|
asyncio_mode = "auto"
|
|
|
|
[tool.coverage.run]
|
|
source = ["easy_tdx"]
|
|
omit = ["tests/*"]
|
|
|
|
[tool.coverage.report]
|
|
# 覆盖率门槛。从 50 提升到 60(审计 #9):补充 reconnect/bitmap/config 测试后
|
|
# 实测约 61%。进一步提到 70 需补 web/ 路由与更多 client 镜像测试,留待后续。
|
|
fail_under = 60
|
|
show_missing = true
|