Live metrics
| kernc/backtesting.py | mementum/backtrader | |
|---|---|---|
| AlgoScore | 73 | 60 |
| ★ | 9.4k | 24k |
| Forks | 1.6k | 5.3k |
| 30d growth | — | — |
| Last push | 05.08.2026 | 19.08.2024 |
| Last release | 22.07.2026 | 19.11.2016 |
| Contributors | 46 | 56 |
| License | AGPL-3.0 | GPL-3.0 |
Point by pointchecked 05.12.2026
| backtesting.py | backtrader | |
|---|---|---|
| Model | Event-driven, minimal API: init() and next() | Event-driven, Cerebro engine with analyzers, sizers and filters |
| Language | Python 3.9+ | Python, no external dependencies except for plotting |
| License | AGPL-3.0 | GPL-3.0 |
| Data | One OHLCV DataFrame per run, any instrument | Multiple feeds and timeframes, resampling and replay |
| Orders | Market, limit, stop, SL/TP | Market, Close, Limit, Stop, StopLimit, StopTrail, OCO, brackets |
| Optimization | Built-in optimizer based on SAMBO | Parameter sweeps via optstrategy |
| Reports and charts | Ready metrics table (Sharpe, Sortino, Calmar, SQN, Kelly) and an interactive chart | Analyzers (Sharpe, SQN, TimeReturn) and matplotlib plots |
| Live trading | None | Interactive Brokers, Oanda, Visual Chart |
| Maintenance | PyPI 0.6.6 on 2026-07-22, last commit 2026-08-05 | Last commit 2023-04-19, issues disabled |
Verdict
Both engines are event-driven and in both you write the strategy in next(), but they differ in size. backtesting.py is deliberately small: a moving-average crossover fits in about ten lines, a single run() returns a table of some thirty metrics, plot() draws an interactive trade chart, and optimize() tunes parameters with SAMBO. It is indicator-library agnostic, and data comes in as one OHLCV DataFrame. There is no live trading; it is a pure research tool. AGPL-3.0 is stricter than plain GPL: if you embed the code in a network service, you must offer the source to its users. backtrader is bigger and more flexible. It handles several feeds and timeframes in one strategy, resampling, replay, sizers, calendars, futures commission schemes and a detailed broker with trailing and bracket orders, plus a path to live brokers. Its weakness is neglect: the last commit on the main branch was in April 2023, and issues are disabled. backtesting.py moves slowly but steadily, with the latest release in July 2026. For portfolio or multi-asset work neither is the best choice; look at vectorbt or nautilus_trader instead.