backtesting.py vs backtrader: simple Python backtesting

AlgoScore backtesting.py / backtrader
73 / 60
★ backtesting.py9.4k
★ backtrader24k
Push backtesting.py4 mo
Push backtrader2.3 y

Live metrics

kernc/backtesting.pymementum/backtrader
AlgoScore7360
★9.4k24k
Forks1.6k5.3k
30d growth——
Last push05.08.202619.08.2024
Last release22.07.202619.11.2016
Contributors4656
LicenseAGPL-3.0GPL-3.0

Point by pointchecked 05.12.2026

backtesting.pybacktrader
ModelEvent-driven, minimal API: init() and next()Event-driven, Cerebro engine with analyzers, sizers and filters
LanguagePython 3.9+Python, no external dependencies except for plotting
LicenseAGPL-3.0GPL-3.0
DataOne OHLCV DataFrame per run, any instrumentMultiple feeds and timeframes, resampling and replay
OrdersMarket, limit, stop, SL/TPMarket, Close, Limit, Stop, StopLimit, StopTrail, OCO, brackets
OptimizationBuilt-in optimizer based on SAMBOParameter sweeps via optstrategy
Reports and chartsReady metrics table (Sharpe, Sortino, Calmar, SQN, Kelly) and an interactive chartAnalyzers (Sharpe, SQN, TimeReturn) and matplotlib plots
Live tradingNoneInteractive Brokers, Oanda, Visual Chart
MaintenancePyPI 0.6.6 on 2026-07-22, last commit 2026-08-05Last 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.

backtesting.pyPick backtesting.py if you want to test an idea on one instrument quickly and get a clear report and chart with no engine setup. It is good for learning, prototypes and checking signals from a terminal. Keep the AGPL in mind if you embed it in a service.
backtraderPick backtrader if you need several timeframes, complex orders, futures commissions or a path to Interactive Brokers from the same code. Remember the library has not been updated since 2023, so newer Python versions may cause trouble.