Skip to content

Fix backtest validation and improve error messaging#1315

Open
htazq wants to merge 1 commit intoNoFxAiOS:devfrom
htazq:fix/backtest-decision-tf
Open

Fix backtest validation and improve error messaging#1315
htazq wants to merge 1 commit intoNoFxAiOS:devfrom
htazq:fix/backtest-decision-tf

Conversation

@htazq
Copy link

@htazq htazq commented Jan 7, 2026

📝 Description | 描述

English: Fix backtest crash when decision_timeframe is not included in timeframes; surface sanitized error messages and keep UI in sync.
中文: 修复回测在决策周期不包含于周期列表时的崩溃问题;改进错误提示并确保前端配置一致。


🎯 Type of Change | 变更类型

  • 🐛 Bug fix | 修复 Bug

🔗 Related Issues | 相关 Issue

  • Related to # (none)

📋 Changes Made | 具体变更

English:

  • Validate decision_timeframe in backtest config and add safe guards in DataFeed to avoid nil panic; return sanitized error to client.
  • Keep decision timeframe in sync with selected timeframes in UI; improve user-facing error hints.

中文:

  • 后端校验 decision_timeframe 必须包含在 timeframes 中,并在 DataFeed 增加空指针保护;将安全的具体错误返回前端。
  • 前端选择周期时自动同步决策周期,避免非法配置;完善用户错误提示。

🧪 Testing | 测试

  • Tested locally | 本地测试通过
  • Tests pass | 测试通过
  • Verified no existing functionality broke | 确认没有破坏现有功能

✅ Checklist | 检查清单

Code Quality | 代码质量

  • Code follows project style | 代码遵循项目风格
  • Self-review completed | 已完成代码自查
  • Comments added for complex logic | 已添加必要注释

Documentation | 文档

  • Updated relevant documentation | 已更新相关文档

Git

  • Commits follow conventional format | 提交遵循 Conventional Commits 格式
  • Rebased on latest dev branch | 已 rebase 到最新 dev 分支
  • No merge conflicts | 无合并冲突

📚 Additional Notes | 补充说明

English: Tests not run locally.
中文: 尚未在本地运行测试。


By submitting this PR, I confirm | 提交此 PR,我确认:

  • I have read the Contributing Guidelines | 已阅读贡献指南
  • I agree to the Code of Conduct | 同意行为准则
  • My contribution is licensed under AGPL-3.0 | 贡献遵循 AGPL-3.0 许可证

@cla-assistant
Copy link

cla-assistant bot commented Jan 7, 2026

CLA assistant check
All committers have signed the CLA.

@htazq
Copy link
Author

htazq commented Jan 7, 2026

Tests not run locally. Please let me know if you want me to run any specific tests.

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.

1 participant