- Python 3.12 or higher
- Polars
- PyYAML
- NumPy
pip install ml4t-backtestOr with uv:
uv add ml4t-backtestgit clone https://github.com/ml4t/backtest.git
cd backtest
pip install -e .from ml4t.backtest import Engine, Strategy, DataFeed, BacktestConfig, run_backtest
from ml4t.backtest import StopLoss, TakeProfit, TrailingStop, RuleChain
print("ml4t-backtest installed successfully")Trading calendars for session enforcement (skip weekends/holidays):
pip install pandas-market-calendarsml4t-diagnostic for post-backtest analysis (tearsheets, trade analytics):
pip install ml4t-diagnostic- Quickstart -- build and run your first backtest