fix: 回测结果买入/卖出次数统计使用 long/short 方向#32
Open
DrIsDr wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 修复学习示例脚本在展示回测结果时,对交易“买入/卖出次数”的统计口径与回测引擎实际记录的交易方向字段不一致的问题(引擎使用 long/short)。
Changes:
- 将交易方向统计从
buy/sell调整为long/short以匹配回测引擎输出 - 在示例回测参数中修改了
end_date(回测区间缩短)
Comments suppressed due to low confidence (1)
学习实例/04_策略回测.py:199
- 本 PR 标题/描述聚焦“回测结果买入/卖出次数统计方向修复”,但这里把回测区间的 end_date 从 20241231 改为 20240228,会显著改变示例回测结果与可复现性。若只是为了缩短演示运行时间,建议在 PR 描述中说明原因,或改为通过参数/提示让用户自行选择;否则应保持原回测区间不变。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
回测引擎记录的交易方向为 'long'/'short',但展示代码按 'buy'/'sell' 过滤,导致买入/卖出次数始终为 0。
c29690b to
c741e71
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复