Skip to content

Trim pre-trade flat period from stats - #520

Open
Whning0513 wants to merge 2 commits into
pmorissette:masterfrom
Whning0513:trim-pretrade-flat-prices-398
Open

Trim pre-trade flat period from stats#520
Whning0513 wants to merge 2 commits into
pmorissette:masterfrom
Whning0513:trim-pretrade-flat-prices-398

Conversation

@Whning0513

Copy link
Copy Markdown
Contributor

Summary

  • trim the leading flat price segment before the first transaction when computing backtest stats
  • keep the full underlying strategy price series intact for other consumers
  • add a regression test for RunAfterDate delaying the first trade

Testing

  • python -m pytest -q tests/test_backtest.py -k "run_after_date_stats_start_on_first_transaction or nested_strategy_backtest_handles_initial_paper_trade_value"
  • python -m pytest -q tests/test_core.py -k "fail_if_0_base_in_return_calc or test_strategy_children_paper_trade"
  • python -m pytest -q tests/test_backtest.py -k "Results_helper_functions or Results_helper_functions_fi or run_after_date_stats_start_on_first_transaction or nested_strategy_backtest_handles_initial_paper_trade_value"

Closes #398

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Whning0513

Copy link
Copy Markdown
Contributor Author

Updated this branch to current master and removed the nested-strategy regression that had already landed in #519. The conflict resolution now keeps only the pre-trade statistics fix and its RunAfterDate regression.

I also aligned RenormalizedFixedIncomeResult with the trimmed statistics index after the full suite exposed that compatibility case. tests/test_backtest.py reports 23 passed locally, and both the Build Status and Regression and Version Tests workflows are now green.

@Whning0513

Whning0513 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Hi! The PR's checks are all green and it is in a clean state. Could you please take another look and merge it when convenient? Thank you! (^o^)

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.

bt.algos.RunAfterDate can not update bt.backtest.Result ( 'Start', 'CARG' etc )

3 participants