Skip to content

fix: 回测结果买入/卖出次数统计使用 long/short 方向#32

Open
DrIsDr wants to merge 1 commit into
quant-king299:mainfrom
DrIsDr:fix/backtest-trade-direction-count
Open

fix: 回测结果买入/卖出次数统计使用 long/short 方向#32
DrIsDr wants to merge 1 commit into
quant-king299:mainfrom
DrIsDr:fix/backtest-trade-direction-count

Conversation

@DrIsDr

@DrIsDr DrIsDr commented Jul 11, 2026

Copy link
Copy Markdown

修复

Copilot AI review requested due to automatic review settings July 11, 2026 01:21

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.

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。
@DrIsDr DrIsDr force-pushed the fix/backtest-trade-direction-count branch from c29690b to c741e71 Compare July 11, 2026 01:28
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