ML4T Backtest
ML4T Backtest Documentation
Event-driven backtesting with realistic execution
Skip to content

Installation

Requirements

  • Python 3.12 or higher
  • Polars
  • PyYAML
  • NumPy
  • Pydantic

Install from PyPI

pip install ml4t-backtest

Or with uv:

uv add ml4t-backtest

Install from Source

git clone https://github.com/ml4t/ml4t-backtest.git
cd ml4t-backtest
pip install -e .

Verify Installation

from ml4t.backtest import Engine, Strategy, DataFeed, BacktestConfig, run_backtest
from ml4t.backtest import StopLoss, TakeProfit, TrailingStop, RuleChain

print("ml4t-backtest installed successfully!")

Optional Dependencies

Trading calendars for session enforcement (skip weekends/holidays):

pip install pandas-market-calendars

ml4t-diagnostic for post-backtest analysis (tearsheets, trade analytics):

pip install ml4t-diagnostic

Next Steps