Files
Justin Gu e374a0da28 release: v1.32.6 — 两周改动深度审查全面修复(回测口径三件套/LLM 安全加固/涨停价舍入/时区统一/缓存与竞态等 58 处)
对 v1.21→v1.32.5 的 249 文件 4.2 万行改动做六路专项审查,本轮落地全部发现:

回测正确性:组合收益 fillna(0) 虚增、轮动停牌日过期价成交、单标的 WF 逐窗指标
被预热区稀释(三件套均带先红后绿回归);worst_drawdown 方向、grading 容错、
组合体检品种费率、寻优端点费率透传。

安全:LLM api_url 仅 http/https 且禁 userinfo(封死 file:// 读取与 Key 外送链)、
错误响应不回显原始 body、响应体 2MB 上限、配置原子写、坏配置字段级防御。

数据:涨跌停价整数分币舍入(67/318/90 个价位错 1 分漏判清零)、交易时段/采样/
provisional 统一沪时区、warehouse 增量缺口自动全量重拉、provisional 定点转正、
baostock 真故障抛错 + W/M 去 tradestatus(实测服务端报错,周月兜底此前从未工作)
+ 指数 vol 股→手(实测锚定)、ccpm 结构变更抛错。

Web API:缓存键补 count/vipdoc、NaN 清洗先于缓存、count>800 分页取全量、
submit 透传真实状态、pending 不再被淘汰成幽灵、watchlist/server 入参约束。

公式:FILTER 去副作用、0-1 值域误判收严、递归深度上限、REF 负移位显式禁止。

前端:4 处请求竞态序号守卫、Sparkline viewBox、北交所 market=2 映射、
空数据缓存死角、AI 弹窗卸载中止轮询、量能/资金日历口径修正。

CLI/CI:warehouse sync 失败 exit 1、参数校验干净报错、release 真实发布 SHA256、
CI 超时与缓存、spec 补 baostock 前提。

约 60 条回归测试先红后绿;pytest 1820 全过,ruff/mypy/vue-tsc/node --test 全绿。
2026-09-06 22:16:48 +08:00

95 lines
3.5 KiB
TOML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "easy-tdx"
version = "1.32.6"
description = "通达信 TCP 协议行情数据客户端,支持在线行情、离线数据读取与写入同步"
readme = "README.md"
requires-python = ">=3.10"
dependencies = ["pandas>=2.0,<3", "tzdata>=2024.1", "click>=8.0,<9"]
[project.scripts]
# 经由守卫转发:可编辑安装失效(仓库被移动/.pth 丢失)时打印修复指引(#58),
# 机制见 _editable_guard.py 模块 docstring。
easy-tdx = "easy_tdx._editable_guard:main"
[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"]
# baostock 自动兜底数据源(TDX 全部路径失败时的最后一级回退,仅日线及以上)。
# 可选安装:不装则该回退环自动关闭,核心功能不受影响。
baostock = ["baostock>=0.9"]
# 打包成桌面 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/。CIci.yml)、publishpublish.yml
# 和 releaserelease.yml)都会在 pip install / build 前先 npm run build。
# _editable_guard.py 一并映射进 site-packages 的碎片目录:可编辑安装失效时
# src/ 代码全部不可达,唯有这份副本可导入,入口守卫才能打印修复指引(#58)。
force-include = { "web-ui/dist" = "easy_tdx/web/dist", "src/easy_tdx/_editable_guard.py" = "easy_tdx/_editable_guard.py" }
[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 stubstray.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