Backtrader
An event-driven Python backtester with 122 indicators, frozen since April 2023.
by Daniel Rodriguez
Last updated
What it is
Backtrader is an event-driven backtesting framework for Python. You subclass bt.Strategy,
hand data feeds and indicators to a Cerebro engine, and it walks the bars one at a time
calling next(), filling orders through a simulated broker. Event-driven rather than
vectorised is the design decision that defines it: it costs speed and buys order semantics a
vectorised engine cannot express — limit, stop, stop-limit, trailing stop, OCO and bracket
orders, slippage models, volume-based filling, and continuous cash adjustment for futures-like
instruments. 122 indicators ship with it, TA-Lib plugs in, and the documentation is unusually
complete for a project of this size.
It is also frozen. Last commit to master and last PyPI release are both version 1.9.78.123,
dated 19 April 2023. The repository is not archived, GitHub issues are turned off, and 63 pull
requests are open — the newest from July 2026, one of them a May 2026 fix for a Python 3.10+
deprecation that is still unmerged. setup.py declares neither python_requires nor a single
dependency, so pip drops it into any interpreter without a word of complaint; the package's own
classifiers stop at Python 3.7. The community forum the README names as the support channel in
place of issues returned a 522 on every attempt on 14 September 2026.
What the simulated broker models is unusually complete for a free library: percentage or fixed
slippage with separate switches for whether opening prices and limit orders slip, volume fillers
that cap a fill at a share of the bar's volume, commission schemes that charge a percentage or a
fixed amount per contract and can add a yearly interest rate for holding a short or a leveraged
position, and a cheat-on-open mode for strategies that size off the opening print. Fifteen
analyzers — Sharpe, SQN, VWR, Calmar, drawdown, time return, transactions, a trade breakdown —
turn a run into statistics without a second library, and optstrategy spreads a parameter grid
across processes.
Data & coverage
None of its own. Built-in feeds read CSV files, pandas DataFrames, Yahoo, and the live stores; everything else is a feed you write or install. Resampling, replay and multi-timeframe are built in, as are trading calendars for non-US sessions, so the framework is market-agnostic and the coverage is whatever you pay someone else for.
Integrations
Live data and trading through Interactive Brokers (IbPy), VisualChart and Oanda v1. Plotting is
matplotlib. pip install backtrader pulls no dependencies at all unless you ask for plotting,
and a btrun command-line runner is installed alongside the library.
Limitations
- Unmaintained since April 2023. Every Python, numpy or matplotlib incompatibility from here is yours to patch or pin around.
- The Oanda store targets an API Oanda retired, and the IB store needs IbPy, archived since January 2017; pyfolio integration is marked deprecated in the project's own README.
- Event-driven means slow. Sweeping a parameter grid over a large universe is where people leave for a vectorised engine.
- No options modelling — no chains, no greeks, no expiry handling. An
Options supportpull request has been open since September 2025. - GPL-3.0-or-later. Embedding it in a closed-source product is a licensing decision, not a free one.
Alternatives
Backtesting.py and VectorBT for speed on parameter sweeps, NautilusTrader and QuantConnect LEAN for a maintained event-driven engine with live brokers, Zipline-reloaded for the pipeline API. Within the backtrader family itself, backtrader_next is the fork with 2026 releases.
The rest are in the backtesting frameworks category.
Specs
- Interfaces
- Python, Python
- Export
- CSV
- Asset classes
- Stocks, ETF, Futures, Forex, Indices
- Markets
- Global
- Platforms
- Library, CLI
- AI features
- None
- Capabilities
- Backtesting, Automation, Live trading, Paper trading
- Pricing verified
- Capabilities verified
- Coverage verified
Also worth comparing
- Backtesting.py — A single-instrument Python backtester — one OHLC series, one strategy, no live trading.
- bt — Python backtesting for allocation and rebalancing rules, not entries and exits.
- fastquant — A one-call wrapper over Backtrader, dormant since 2023 and broken on PyPI.
- QSTrader — An institutional-shaped Python backtester whose last commit to master was June 2024.
- Zipline-reloaded — The maintained fork of Quantopian's Zipline. Bring your own data — it ships almost none.
- AmiBroker — Windows portfolio backtester scripted in AFL, sold as a perpetual licence.
FAQ
Is backtrader still maintained?
No. The last commit to master and the last PyPI release are both 1.9.78.123 on 19 April 2023, and the last merged pull request is from the same day. The repository is not archived and 63 pull requests sit open, the newest filed in July 2026 — including one from May 2026 fixing a Python 3.10+ deprecation. Nothing is being merged.
Has the backtrader2 community fork taken over?
No, and this is the most common misreading. The backtrader2 organisation forked the project to keep it alive, but its last commit is from November 2021 and its PyPI package stopped at 1.9.76.123 in July 2020 — two point releases behind the original. The fork is staler than the thing it forked.
Which fork is actually being released in 2026?
backtrader_next, published on PyPI as backtrader-next, shipped 2.3.7 on 26 March 2026 and requires Python 3.11 or newer. It is small — under 100 stars, classified alpha — so it is a live fork rather than an anointed successor. It is not a drop-in for code pinned to the original package name.
Can backtrader place real orders?
Yes, through three built-in stores — Interactive Brokers via IbPy, VisualChart via a forked comtypes, and Oanda. Each rests on a dependency that stopped moving — IbPy was archived in January 2017. The Oanda store speaks the retired v1 REST API — the README says v20 did not support streaming when it was implemented — so a working Oanda setup today means a third-party v20 package, not the shipped store.