mirror of
https://github.com/laoxong/nofx.git
synced 2026-06-04 09:58:22 +08:00
a41f2f5a72
* fix(decision): clarify field names for update_stop_loss and update_take_profit actions 修复 AI 决策中的字段名混淆问题: **问题**: AI 在使用 update_stop_loss 时错误地使用了 `stop_loss` 字段, 导致解析失败(backend 期望 `new_stop_loss` 字段) **根因**: 系统 prompt 的字段说明不够明确,AI 无法知道 update_stop_loss 应该使用 new_stop_loss 字段而非 stop_loss **修复**: 1. 在字段说明中明确标注: - update_stop_loss 时必填: new_stop_loss (不是 stop_loss) - update_take_profit 时必填: new_take_profit (不是 take_profit) 2. 在 JSON 示例中增加 update_stop_loss 的具体用法示例 **验证**: decision_logs 中的错误 "新止损价格必须大于0: 0.00" 应该消失 * test(decision): add validation tests for update actions 添加针对 update_stop_loss、update_take_profit 和 partial_close 动作的字段验证单元测试: **测试覆盖**: 1. TestUpdateStopLossValidation - 验证 new_stop_loss 字段 - 正确使用 new_stop_loss 字段(应通过) - new_stop_loss 为 0(应报错) - new_stop_loss 为负数(应报错) 2. TestUpdateTakeProfitValidation - 验证 new_take_profit 字段 - 正确使用 new_take_profit 字段(应通过) - new_take_profit 为 0(应报错) - new_take_profit 为负数(应报错) 3. TestPartialCloseValidation - 验证 close_percentage 字段 - 正确使用 close_percentage 字段(应通过) - close_percentage 为 0(应报错) - close_percentage 超过 100(应报错) **测试结果**:所有测试用例通过 ✓ --------- Co-authored-by: Shui <88711385+hzb1115@users.noreply.github.com>