Python Backtesting Libraries in 2026: What the Rankings Get Wrong
Key takeaway
Backtrader tops almost every 2026 ranking of Python backtesting libraries. Its last commit was in April 2023. We ran it against VectorBT and backtesting.py on the same prices: once their fills are aligned they agree to within one trade, and what separates them is speed and licence.
Backtrader appears at or near the top of almost every list of Python backtesting libraries published this year. Its last commit to GitHub was on 19 April 2023. The two facts sit together comfortably because nobody checks: the rankings are copied from each other, and a library with 23,000 stars looks alive whether or not anyone is still maintaining it.
This article does the boring thing instead. Every number below was pulled from the package registry and the source repository on 17 September 2026 and re-checked on 4 November 2026, and anyone can re-run the same check in a minute. The conclusion is not the one the rankings give you, and the deciding factor turns out to be something they almost never mention: the licence.
The table
| Library | Stars | Last commit | Latest release | Licence |
|---|---|---|---|---|
| Freqtrade | 56,421 | 3 Nov 2026 | 2026.10 (30 Oct 2026) | GPL-3.0 |
| NautilusTrader | 31,218 | 4 Nov 2026 | 1.231.0 (2 Aug 2026) | LGPL-3.0 |
| Backtrader | 23,663 | 19 Apr 2023 | 1.9.78.123 (19 Apr 2023) | GPL-3.0 |
| VectorBT | 9,676 | 3 Nov 2026 | 1.2.0 (19 Oct 2026) | Apache 2.0 + Commons Clause |
| backtesting.py | 9,192 | 5 Aug 2026 | 0.6.6 (22 Jul 2026) | AGPL-3.0 |
| Zipline-reloaded | 1,997 | 2 Nov 2026 | 3.2.1 (25 Oct 2026) | Apache-2.0 |
Three things jump out, and none of them appears in the usual comparison posts.
1. The most recommended library has been frozen for three and a half years
Backtrader’s last commit is dated April 2023 and its last release on PyPI is the same day. That is three years and six months of no changes, against a Python release cadence of roughly one version a year. It is not abandoned in the sense of being deleted — the code still installs and still runs — but nothing that has happened to Python, pandas or any exchange API since 2023 has been accounted for.
This does not make it useless. Backtrader’s event-driven design is still the clearest teaching model of how an order actually reaches a broker, and its documentation remains better than most of what replaced it. If you are learning how a backtest is structured, it is a reasonable place to start. If you are building something you intend to run against live data in 2027, you are adopting a dependency that nobody is going to patch for you.
The honest summary: excellent to read, risky to depend on.
2. The licence is the decision, not the speed
This is the part that gets left out, and it is the part that costs money.
Backtesting frameworks are mostly published under copyleft licences, and copyleft has consequences that only appear when you try to turn your strategy into a product:
- AGPL-3.0 — backtesting.py. The AGPL extends the obligation to software offered over a network. If you build a web service on top of it and let other people use it, the licence asks you to make your source available to those users. For a personal backtest this is irrelevant; for a subscription product it is the whole ball game.
- GPL-3.0 — Backtrader and Freqtrade. Distributing a derived work means distributing the source. Running it privately for your own trading does not trigger anything.
- LGPL-3.0 — NautilusTrader. Materially more permissive when the library is used as a library rather than modified.
- Apache-2.0 — Zipline-reloaded. The most business-friendly of the set, with an express patent grant.
- Apache 2.0 with Commons Clause — VectorBT. The Apache licence comes with a condition added on top: it withholds the right to sell a product or service whose value derives entirely or substantially from VectorBT. GitHub reports the licence as unclassified because of that addition, which is a flag worth taking seriously: a non-standard licence is one your own lawyer has to read rather than recognise.
Ordered by “can I build a commercial product on this without a conversation”, the ranking inverts almost completely: Apache first, then LGPL, then the GPL pair, then AGPL. VectorBT sits in a category of its own: it is the only one of the six whose licence rules out that use directly, when the product’s value comes substantially from the library. Not one of the popularity rankings mentions this.
3. The two most active projects are not backtesters
Freqtrade and NautilusTrader both had commits within a day of our last check. They are also the two largest by stars. But neither is a backtesting library in the sense that Backtrader is: they are trading systems that include a backtester.
That difference matters more than it sounds. A backtester answers “would this rule have worked”. A trading system also has to answer “how do I hold state across a restart”, “what happens when the exchange rejects the order” and “who pages me at 3am”. If what you want is to test an idea over ten years of daily bars, adopting one of these means carrying a great deal of machinery you will not use.
Backtesting.py vs VectorBT vs Backtrader: the same rule in all three
The table above says which projects are alive. It does not say whether three engines given the same rule and the same prices produce the same answer, or how long they take to produce it. So we ran one.
The rule: hold 100 units while the 10-day moving average is above the 30-day one, and nothing otherwise, with no costs and $1,000,000 of starting cash. The prices are synthetic on purpose, a random walk of 7,560 daily bars (about 30 years) with a fixed seed: the question is whether the engines agree, not whether the rule makes money.
| backtesting.py | VectorBT | Backtrader | |
|---|---|---|---|
| How it simulates | Calls your next() once per bar |
Whole arrays at once, compiled with Numba | Event-driven: next() once per bar, orders through a simulated broker |
| Default fill for a market order | Next bar’s open | Close of the bar that gave the signal | Next bar’s open |
| Instruments per backtest | One OHLC DataFrame | Many, as columns, with optional shared cash | Many data feeds |
| Parameter search | optimize(): grid or model-based (SAMBO) |
Broadcast over arrays of parameters | optstrategy() |
| Live broker connectors | None | None | Interactive Brokers, Oanda, Visual Chart (built on IbPy, last released 2016, and oandapy, last released 2018) |
| Licence | AGPL-3.0 | Apache 2.0 + Commons Clause | GPL-3.0 |
| Python declared on PyPI | 3.9 or later | 3.11 to 3.14 | None |
| One backtest, 7,560 bars | 0.04 s | 0.01 s | 0.41 s |
| 90 parameter pairs | 3.6 s | 0.09 s in one call (1.3 s as a loop) | 37.5 s |
Configured alike, they agree. With every fill at the next bar’s open, Backtrader and VectorBT finished with the same equity to the cent, $1,074,603.05, from the same 131 entries. backtesting.py finished $134.68 higher, and the whole gap comes from the first trade. Its loop starts one bar after the slowest indicator has a value, so when the averages were already crossed on that first bar, 12 February 1996 in this sample, it bought on the 14th instead of the 13th. Every later trade is identical.
Left on their defaults, they do not. VectorBT fills at the close of the bar that produced the signal; the other two at the next open. On these prices that turned $74,603 of profit into $71,502, 4.2% less, from a setting most users never look at. Neither default is wrong, but a same-close fill assumes you can trade at the price you needed to see before deciding, and a live account cannot. Before comparing a result from one library with a result from another, check which price each one fills at.
Speed is real, and it is mostly the grid. Over 90 pairs of averages, VectorBT took 0.09 seconds in one broadcast call, roughly 400 times faster than a loop of Backtrader runs and 40 times faster than backtesting.py. Run as a loop like the others, VectorBT took 1.3 seconds: most of the advantage comes from testing every pair at once rather than from each run being fast. Backtrader was about ten times slower than backtesting.py on the same loop.
All three picked the same best pair, 5 and 40 days. On random prices that is the useful lesson: a parameter grid always has a winner, and a faster library only finds it sooner.
The script that prints every figure is published alongside this article’s working files.
What each one is actually for
| If you want to… | Use | Because |
|---|---|---|
| Learn how a backtest is built | Backtrader | Clearest event-driven model and the best docs; accept that it is frozen |
| Sweep thousands of parameter sets | VectorBT | Vectorised over arrays, orders of magnitude faster for grids; read the licence first |
| Run research with a data pipeline | Zipline-reloaded | Bundles and the Pipeline API; Apache licence; release 3.2.1 in October 2026 |
| Trade crypto live | Freqtrade | Most active project of the six, exchange integrations included |
| Build low-latency infrastructure | NautilusTrader | Rust core, event-driven, LGPL |
| Test one idea this afternoon | backtesting.py | Smallest surface area of the six; AGPL makes it a poor base for a product |
How to check this yourself
The point of this article is not the table; it is that the table goes stale and you should not have to trust it. Both registries expose the numbers without authentication:
- Release and version:
https://pypi.org/pypi/<package>/jsonreturns the current version and its upload date. - Activity and licence:
https://api.github.com/repos/<owner>/<repo>for stars and licence, and/commits?per_page=1for the date of the most recent commit.
Two minutes, no account. Do it before adopting any dependency you intend to run with money behind it, and do it again a year later.
The thing the library will not save you from
Choosing well matters less than most people writing about it suggest. None of these six protects you from the errors that make a backtest lie: look-ahead bias, survivorship in the price series, costs modelled optimistically, or a parameter grid searched until something looked good. We measured what each of the four does to a result in how to read a backtest without fooling yourself. A faster library only lets you overfit sooner, and the six checks in how to test a technical indicator before trusting it apply whichever engine runs the backtest.
That is the more useful thing to get right, and it is where the sizing question lives too — a strategy with a genuine edge still ruins an account if the position size is wrong, which is the arithmetic behind why nobody runs full Kelly and behind position sizing and risk of ruin. For the strategy layer above the tooling, see our guide to algorithmic trading strategies.
What a live trading bot needs besides the library
Most searches for “the best Python library for a trading bot” assume the library is the bot. It is one layer of four, and the other three are where live accounts actually get hurt.
- A broker or exchange API. Something has to send the order. For US equities, Alpaca’s official client is
alpaca-py(Apache-2.0, version 0.44.0 released 11 August 2026). For Interactive Brokers, the widely usedib_insyncwrapper is archived on GitHub, with its last commit on 14 March 2024; the maintained continuation isib_async(BSD-2-Clause, version 2.1.0 released 8 December 2025). For crypto exchanges,ccxt(MIT) is the common layer, and Freqtrade already builds on it. - Data you can trust at the moment of the trade. Free adjusted daily prices are adequate for research and inadequate for execution. A backtest on one feed and live orders on another is a silent source of divergence; our evidence review of algorithmic trading strategies covers what a retail data stack looks like and where it breaks.
- Risk rules that do not depend on the strategy being right. A maximum size per position, a maximum daily loss, and a switch that stops the bot when either is hit. How large each position should be is not a coding question; it is the arithmetic of position sizing and risk of ruin, and it decides whether a real edge survives a bad run.
- Operations. State that survives a restart, handling for rejected and partially filled orders, logs, and an alert when something stops. This is the machinery Freqtrade and NautilusTrader include and the pure backtesters do not.
The practical consequence: choose the backtesting library for the research you need to do, and choose the broker API for the market you intend to trade — they are separate decisions, and the second one limits the first more often than the reverse. Our complete guide to algorithmic trading in 2026 walks through the full system, from strategy to execution, and before any real order, run the whole chain in paper trading: Freqtrade starts in dry-run mode by default, and Alpaca offers a free paper-only account.
In short
Backtrader leads the 2026 rankings and has not been touched since April 2023. Freqtrade and NautilusTrader are the live projects, but they are trading systems rather than backtesters. Zipline-reloaded is the only one of the six under a permissive licence, and backtesting.py is AGPL, which decides the question for anyone planning to charge for what they build. Pick for the job and the licence, verify the dates yourself, and remember that the library is not what makes a backtest honest.
Frequently asked questions
What is the best Python library for a trading bot in 2026?
It depends on what the bot trades, because a backtesting library on its own is not a bot. For crypto, Freqtrade is a complete system with exchange integrations and a simulated dry-run mode, and it was the most active project in our comparison (release 2026.10 on 30 October 2026). If you need a deterministic, event-driven engine with a Rust core, NautilusTrader is the other live-capable framework. Backtrader, VectorBT and backtesting.py test strategies; to trade live they need a broker API such as alpaca-py, ib_async or ccxt. Checked 4 November 2026.
What is the difference between a backtesting library and a live trading framework?
A backtesting library answers whether a rule would have worked on past data. A live trading framework also has to place orders, keep state across restarts, handle rejections and partial fills, and alert you when something breaks. Freqtrade and NautilusTrader are trading systems that include a backtester; Backtrader, VectorBT, backtesting.py and Zipline-reloaded are primarily research tools.
Is Backtrader still maintained?
Not actively. As of 4 November 2026, the last commit to its GitHub repository was on 19 April 2023, and its latest PyPI release, 1.9.78.123, is from the same day. The repository is not archived and the package still installs, so it remains a good way to learn how an event-driven backtest works, but nothing released since 2023 in Python, pandas or broker APIs has been accounted for.
Should I use VectorBT or backtesting.py?
VectorBT if you need to test thousands of parameter combinations, because it works on whole arrays at once; backtesting.py if you want to test one idea quickly with the smallest amount of code. The licence matters more than the speed if you plan to sell anything: VectorBT is Apache 2.0 with a Commons Clause that withholds the right to sell a product whose value derives substantially from it, and backtesting.py is AGPL-3.0, which extends source-sharing obligations to software offered over a network. Both were active as of 4 November 2026: VectorBT’s last commit was on 3 November 2026 and backtesting.py’s on 5 August 2026.
Can I build a trading bot in Python for free?
The software, yes: all six libraries in this comparison are free to use, and you can run the full chain without money at risk — Freqtrade’s dry-run mode is on by default, and Alpaca’s paper-only account is free and open to anyone with an email address. Trading live is never free. Commissions, spreads, data and hosting all cost something, and for a strategy with a thin edge they are often the difference between profit and loss.
Which Python version should I use for a trading bot in 2026?
Check what your framework declares on PyPI rather than assuming. As of 4 November 2026, NautilusTrader requires Python 3.12 to 3.14, VectorBT 3.11 to 3.14, Freqtrade 3.12 or later, Zipline-reloaded 3.11 to 3.14 and backtesting.py 3.9 or later. Backtrader declares no requirement at all, which, for a package last released in 2023, means nobody has confirmed it on recent versions.
Sources
- GitHub REST API,
/repos/<owner>/<repo>and/commits?per_page=1, for stars, licence, archive status and last commit: Backtrader, VectorBT (licence text: Apache 2.0 with Commons Clause), backtesting.py, Freqtrade, NautilusTrader, Zipline-reloaded, ib_insync, ib_async, alpaca-py, ccxt. Table, FAQ and broker-API figures checked 4 November 2026. - PyPI JSON API,
https://pypi.org/pypi/<package>/json, for latest versions, release dates and declared Python versions. Checked on the same date. - Freqtrade documentation, Configuration:
dry_rundefaults to true, and in dry-run orders are simulated and not posted to the exchange. - Source code of backtesting 0.6.6 (
Backtest.run: the loop starts at1 + _indicator_warmup_nbars), vectorbt 1.2.0 (Portfolio.from_signals:pricedefaults tonp.inf, the bar’s close) and backtrader 1.9.78.123 (BackBroker:cocdefaults toFalse), for the default fills in the comparison. - Alpaca documentation, Paper Trading: the paper environment is free, and a paper-only account needs only an email address. Checked 25 September 2026.
Related reading
- vectorbt in practice — a reproducible backtest from raw data to report, and the default settings that inflate it.
- How to test a technical indicator before trusting it — six checks a backtest has to pass, run on 90 rule variants.
- Which algorithmic trading strategies are actually profitable? — the evidence, the costs and a reproducible backtest.
- Algorithmic trading strategies for 2026 — the full system, from idea to execution.
- Position sizing and the risk of ruin — the rule that decides whether a strategy survives.
- The Kelly criterion — why nobody sizes at full Kelly.
- AI trading agents in 2026 — what changes when the strategy is a model rather than a rule.
- The Sharpe ratio — the risk-adjusted number most backtest reports lead with.
Figures verified against the PyPI and GitHub APIs on 4 November 2026 and valid as of that date; the comparison of backtesting.py, VectorBT and Backtrader was run the same day. Educational content only; not investment advice. AssetWhisper does not publish trading signals.



