Skip to content

Include final-bar open trades in results - #1382

Draft
bm1016bm-svg wants to merge 1 commit into
kernc:masterfrom
bm1016bm-svg:agent/include-open-trades
Draft

Include final-bar open trades in results#1382
bm1016bm-svg wants to merge 1 commit into
kernc:masterfrom
bm1016bm-svg:agent/include-open-trades

Conversation

@bm1016bm-svg

Copy link
Copy Markdown

Summary

  • process orders placed during the final strategy iteration
  • include still-open trades in results when finalize_trades=False
  • represent their exit fields with NaN and keep exposure and indicator columns valid
  • add regression coverage for final-bar orders and update the affected trade-count expectation

Fixes #1342.

Testing

  • python -m backtesting.test (81 tests: 80 passed, 1 platform-specific skip)
  • flake8 backtesting/_stats.py backtesting/backtesting.py backtesting/test/_test.py

Local limitation

mypy backtesting could not start because Windows Application Control blocked mypy's native DLL. GitHub Actions should provide the authoritative type-check result.

AI assistance

OpenAI Codex assisted with issue discovery, implementation, tests, and validation. I reviewed the change and test results.

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.

Finalize Trades

1 participant