mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 15:44:18 +08:00
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 全绿。
This commit is contained in:
@@ -141,3 +141,67 @@ class TestPortfolioCLIFlags:
|
||||
assert "--evaluate" in result.output
|
||||
assert "--wf" in result.output
|
||||
assert "--auto-fees" in result.output
|
||||
|
||||
|
||||
class TestIgnoredFlagWarnings:
|
||||
"""静默忽略的旗标组合必须显式告警(stderr),不得无提示吞掉。"""
|
||||
|
||||
def test_combo_with_wf_warns(self):
|
||||
"""--combo-strategies + --wf:旧码静默忽略,新码应告警并继续报策略文件错误。"""
|
||||
from easy_tdx.backtest.cli import backtest
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
backtest,
|
||||
[
|
||||
"SZ",
|
||||
"000001",
|
||||
"--combo-strategies",
|
||||
"nope_a.py,nope_b.py",
|
||||
"--wf",
|
||||
],
|
||||
)
|
||||
assert "已忽略" in result.output
|
||||
assert result.exit_code != 0 # 随后仍因策略文件不存在报错(无网络依赖)
|
||||
|
||||
def test_combo_with_evaluate_warns(self):
|
||||
from easy_tdx.backtest.cli import backtest
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
backtest,
|
||||
[
|
||||
"SZ",
|
||||
"000001",
|
||||
"--combo-strategies",
|
||||
"nope_a.py,nope_b.py",
|
||||
"--evaluate",
|
||||
],
|
||||
)
|
||||
assert "已忽略" in result.output
|
||||
|
||||
def test_single_with_wf_no_warning(self):
|
||||
"""单策略 + --wf 是合法组合,不告警(在策略校验失败前无「已忽略」字样)。"""
|
||||
from easy_tdx.backtest.cli import backtest
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(backtest, ["SZ", "000001", "--wf"])
|
||||
assert "已忽略" not in result.output
|
||||
|
||||
def test_optimize_all_with_param_warns(self):
|
||||
"""--all + --param:旧码静默忽略自定义网格,新码应告警。"""
|
||||
from easy_tdx.backtest.cli import optimize
|
||||
|
||||
runner = CliRunner()
|
||||
# 用非法市场名在联网取数前中断,仅验证告警已发出
|
||||
result = runner.invoke(optimize, ["XX", "000001", "--all", "--param", "fast=5,10"])
|
||||
assert "忽略" in result.output
|
||||
|
||||
def test_optimize_single_with_param_no_warning(self):
|
||||
from easy_tdx.backtest.cli import optimize
|
||||
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
optimize, ["XX", "000001", "--strategy", "ma_cross", "--param", "fast=5,10"]
|
||||
)
|
||||
assert "已忽略" not in result.output
|
||||
|
||||
Reference in New Issue
Block a user