mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 13:24:18 +08:00
通达信服务端 K 线记录第一个 4 字节字段的语义随周期/品种变化,此前原样 透传错误数据(逐字节拆包 + 新浪实时行情/东方财富三方交叉验证锁定): - 指数分钟线(MIN_1/3/5/15/30/60,含 880xxx 板块指数):f1 实为 成交额(百元),与 amount 恒差 100 倍,真实分钟成交量不在报文中 (15:00 上证 5min 真值 13,954,814 手 vs 返回 208,748,512≈amount/100) → vol 置 NaN,不拿成交额冒充成交量; - 指数与个股周/月/季/年线(cat 5/6/10/11):f1 = 真实成交量/100 (上证本周三日日线 vol 合计 1,666,668,288 手 vs 周线 16,666,683) → ×100 还原,与日线单位对齐(指数=手、个股=股); - 日线(cat 4)与 cat 9(日线变体,枚举名误标 YEAR,真年线是 cat 11) 不受影响,cat 9 明确不套 ×100 并由测试锁定。 配套:DataFrameResponse NaN→null(Starlette allow_nan=False 透传会 500); client/路由 docstring 写明各单位;回归测试 7 例(实抓原始字节构造报文); 验收脚本 scripts/verify_issue64.py 连真实服务器复测。附带发现仅记录: 指数分时 vol=成交额(万元)、/bars?category=YEAR 实际返回日线(cat 9)。
88 lines
2.8 KiB
TOML
88 lines
2.8 KiB
TOML
[build-system]
|
||
requires = ["hatchling"]
|
||
build-backend = "hatchling.build"
|
||
|
||
[project]
|
||
name = "easy-tdx"
|
||
version = "1.28.2"
|
||
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", "duckdb>=1.0"]
|
||
science = ["scipy>=1.10,<1.16"]
|
||
web = ["fastapi>=0.110,<1", "uvicorn[standard]>=0.29"]
|
||
# 本地 K 线数据仓库(easy-tdx warehouse ...):DuckDB 单文件列存
|
||
warehouse = ["duckdb>=1.0"]
|
||
# 打包成桌面 EXE 用:系统托盘(pystray)+ 图标生成(Pillow)。
|
||
# 仅 PyInstaller 打包态需要,开发态 ``pip install -e .[web]`` 不强制装。
|
||
packaging = ["pystray>=0.19", "Pillow>=10.0"]
|
||
|
||
[tool.hatch.build]
|
||
# 前端 dist 是构建产物(在 .gitignore 里),hatchling 默认不打包。
|
||
# artifacts 让它被 sdist 和 wheel 都强制包含。
|
||
artifacts = [
|
||
"web-ui/dist/",
|
||
]
|
||
|
||
[tool.hatch.build.targets.wheel]
|
||
packages = ["src/easy_tdx"]
|
||
# 前端 dist 映射到包内 easy_tdx/web/dist/。CI(ci.yml)、publish(publish.yml)
|
||
# 和 release(release.yml)都会在 pip install / build 前先 npm run build。
|
||
force-include = { "web-ui/dist" = "easy_tdx/web/dist" }
|
||
|
||
[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]]
|
||
# pystray / Pillow 无 type stubs;tray.py 已用 type: ignore 兜底关键调用
|
||
module = ["pystray", "pystray.*", "PIL", "PIL.*"]
|
||
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
|