Skip to content

Reject invalid configuration and execution costs atomically #41

Description

@stefan-jansen

Findings: BR-020.

Make all public engine construction paths enforce BacktestConfig validation and reject negative,
NaN, or infinite commission, slippage, impact, and execution-price outputs before state mutation.
Errors must name the invalid field or model and value.

Primary surfaces: config.py, engine.py, broker.py, commission and slippage models,
execution/fill_executor.py, accounting gatekeeper tests.

Acceptance:

  • Public Engine and run_backtest reproductions reject every invalid built-in configuration.
  • Custom model outputs are checked before cash, orders, fills, positions, trades, or metrics change.
  • Complete pre/post state snapshots prove atomicity for negative, NaN, and infinite cases.
  • Valid existing configurations retain their behavior and the full suite passes.

Dependencies: none.


Plan reference: /home/stefan/ml4t/libraries/ml4t-backtest-dev/.workspace/work/backtest-stable-release/milestone-1/plan.md - Issue 1 in milestone 0.1.0-m1 - Financial correctness and auditability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions