Skip to content

feat: attach stress note to backtest reports - #33

Merged
XucroYuri merged 4 commits into
mainfrom
goratio-dev-stress-backtest
Sep 3, 2026
Merged

feat: attach stress note to backtest reports#33
XucroYuri merged 4 commits into
mainfrom
goratio-dev-stress-backtest

Conversation

@XucroYuri

Copy link
Copy Markdown
Owner

新增 attach_stress_note,把负油价事件与说明附加到回测报告。

Copilot AI lite review requested due to automatic review settings September 3, 2026 00:45
@XucroYuri
XucroYuri merged commit 93aab0f into main Sep 3, 2026
11 checks passed
@XucroYuri
XucroYuri deleted the goratio-dev-stress-backtest branch September 3, 2026 00:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

attach_stress_note() 中事件序列化方式与文案范围表述存在可改进点,建议修正以避免后续兼容性与语义误导。

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

本 PR 新增 attach_stress_note(),用于将原始数据中的非正价格(负/零价)压力事件与说明附加到回测(backtest)报告中,避免负油价等尾部事件在报告层被“静默消失”,并同步补充了测试与文档记录。

Changes:

  • goratio.stress 中新增 attach_stress_note(raw, backtest_report),输出 stress_eventsstress_note
  • 增加对应单元测试覆盖回测报告附加字段的行为。
  • 更新 CHANGELOG.md.planning/ROADMAP.md 记录新增能力与测试数量。
File summaries
File Description
tests/test_stress.py 新增测试用例验证回测报告可附加压力事件与说明。
src/goratio/stress.py 新增 attach_stress_note() 将非正价格事件与提示信息注入回测报告。
CHANGELOG.md 记录新增 attach_stress_note() 能力。
.planning/ROADMAP.md 路线图勾选该能力并更新测试数量统计。
Review details

Suppressed comments (1)

src/goratio/stress.py:55

  • scan_non_positive_events() scans both gold and oil; wording here currently singles out oil. Consider using a generic phrase like “非正价格事件” to match the actual data attached in stress_events.
        "负油价/零价事件未进入正价格回测样本;如需压力测试请使用合约级原始数据单列场景"
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/goratio/stress.py
Comment on lines +49 to +53
events = scan_non_positive_events(raw)
report = dict(backtest_report)
report["stress_events"] = [
event.__dict__ for event in events
]
Comment thread src/goratio/stress.py


def attach_stress_note(raw: RawMarketData, backtest_report: dict) -> dict:
"""把负油价压力事件状态附加到 backtest 报告中。"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants