How to choose a backtesting framework: nine open-source engines compared
Pick the market and the live-trading requirement first. Then the licence.
Short answer: there is no single best backtesting framework. backtrader still runs and is fine for learning, but it is not still maintained: the repository has been quiet for a long time, so do not base a new project on it. vectorbt is the maintained alternative when you want to test many parameter sets at once instead of walking one bar at a time. vnpy fits China futures or live orders, and Qlib fits machine-learning stock selection. Check the licence before you commit.
How to choose: name the market and whether the same code must send live orders, then read the licence and the maintenance column. Learning the idea usually starts with backtrader. China futures, or a live connection, points to vnpy. A sweep of many parameter sets points to vectorbt. Scoring stocks with a model points to Qlib.
Who it is for: someone who already writes a little Python and will install an open-source framework on their own computer, and needs a starting point for China A-share research, China futures, US stocks, or machine-learning stock selection.
Who it is not for: someone who wants a hosted website to provide the data and the compute, or who is choosing a broker terminal or a trading bot. Those are different jobs. This page compares local backtesting frameworks only.
The same nine-framework comparison in Chinese is how to choose a backtesting framework (Chinese). A shorter English note that only covers backtrader and four maintained alternatives is backtrader and maintained alternatives. That note is not this article. Broker terminals for China A-shares are how to choose a quant trading platform, and the QMT versus PTrade deep dive is how to choose between QMT and PTrade. Neither is an English alternate of this page.
This site has no commercial relationship with the projects below. Stars and maintenance status come from GitHub and refresh daily. The other facts were checked against each project README and its licence from 11 to 13 Oct 2026. Licences can change.
01 · Nine frameworks, one table
| Tool | What it is | Style and scope | Licence | GitHub stars | Maintenance |
|---|---|---|---|---|---|
| backtrader | Long-standing event-driven framework. Beginner tutorials often use it as the example. The repository has been quiet for a long time | Event-driven; backtest and live trading | GPL-3.0 | 23.6k | No commits in over six months |
| vnpy | Python quant trading platform that connects several broker and exchange interfaces. From version 4.0 it includes a multi-factor machine-learning module | Event-driven; backtest and live trading, including futures CTA | MIT | 46.1k | Commits today |
| rqalpha | Ricequant's open-source framework for backtests and simulated trading. It can be extended with Mods | Event-driven; backtest and simulated trading | Non-commercial use only | 6.8k | Last commit 5 days ago |
| Qlib | Microsoft's open-source AI quant platform. The emphasis is data processing and model training. Backtesting is one step in that workflow | Machine-learning research workflow | MIT | 49.7k | Last commit 5 days ago |
| vectorbt | Packs many parameter combinations into arrays and evaluates them together. Suited to large sweeps. Some features are in a paid PRO edition | Vectorized; backtest and strategy research | Apache 2.0 with Commons Clause | 9.6k | Last commit 4 days ago |
| zipline-reloaded | Community-maintained continuation of Quantopian's zipline after that repository stopped updating | Event-driven; backtest | Apache-2.0 | 2k | Commits today |
| nautilus_trader | Rust core with strategies written in Python. Backtest and live trading share one codebase | Event-driven; backtest and live trading | LGPL-3.0 | 30.9k | Commits today |
| Lean | QuantConnect's open-source engine. Modular design. Strategies can be written in Python or C# | Event-driven; backtest and live trading | Apache-2.0 | 22.3k | Commits today |
| PyBroker | Backtesting framework aimed at machine-learning strategies | Rules and models; backtest | Apache 2.0 with Commons Clause | 3.7k | Commits today |
Licence text was checked from 11 to 13 Oct 2026. The maintenance column is the live reading, not a promise that a quiet repository will stay quiet.
02 · Three differences that decide the shortlist
- Event-driven or vectorized. An event-driven engine walks forward one bar at a time and handles orders the way a live session does. It is easier to read and slower to run. A vectorized engine treats the whole history as one table and evaluates many parameter sets together. It is much faster, and awkward for order logic that depends on a running position.
- Research only, or the same code for live orders. Some libraries only replay history. Some can connect to a broker or an exchange. If you expect to trade the strategy later, a framework that can share one codebase saves a rewrite. Sharing a codebase does not remove the need to paper trade first.
- A library on your machine, or a hosted platform. Every framework on this page is installed locally. You bring the data. A web platform runs the strategy in the vendor's environment, which is faster to open and leaves the strategy and the data on someone else's system. That choice is not this comparison.
03 · backtrader: fine for learning, quiet as a project
backtrader is the event-driven library most beginner tutorials still use. It reads CSV files, online data, or pandas, and its README also describes live trading through Interactive Brokers and other connections. It is a reasonable first framework if the goal is to see how a backtest walks forward.
The repository has had no sustained updates for a long time. See the maintenance column above for the current reading. Python and pandas keep moving, and a break is yours to fix. Use it to learn the idea. For a project you expect to keep, pick a framework that is still maintained. The licence is GPL-3.0. A worked China A-share example is the first backtrader strategy. The same article in Chinese is the Chinese edition.
04 · China markets: vnpy and RQAlpha
vnpy (VeighNa) describes itself as a Python framework for building a quant trading system, with several trading gateways. Its README names private funds, brokers, and futures firms among users. Futures CTA is a primary use, and version 4.0 added vnpy.alpha for multi-factor machine-learning strategies. The licence is MIT, so commercial use is allowed on MIT terms. It is a whole trading platform. It is heavy if you only want to try one idea this afternoon.
RQAlpha is Ricequant's open-source framework for backtests and simulated trading. Strategies can be extended with Mods, and a strategy written here can also be run on Ricequant's hosted platform. The licence is the constraint: the README limits use to non-commercial work and says commercial use needs Ricequant's permission. Personal research is in scope. A company product is not, until you have asked.
05 · Machine learning: Qlib
Qlib is Microsoft's open-source AI quant platform. The work it is built for sits in front of the backtest: data, features, and model training. The backtest is one step in that pipeline. If the strategy is "score stocks with a model, then select," Qlib is the shorter path. If the strategy is a moving-average cross, Qlib is a detour. The licence is MIT. The install, community China A-share data, and a first Alpha158 + LightGBM run are in the Qlib walkthrough. The same article in Chinese is Qlib (Chinese).
06 · Parameter sweeps: vectorbt
vectorbt is vectorized. It does not run one strategy, then the next. It packs many parameter combinations into NumPy arrays and evaluates them together, with Numba for speed. That is the right shape for a parameter scan and for research.
Two limits before you adopt it. The licence is Apache 2.0 with a Commons Clause: you can use it without paying, and you cannot sell a product whose primary function is vectorbt. Some features live in a separate paid PRO edition.
07 · The other four
- zipline-reloaded: the original zipline came from Quantopian. After the company shut down, that repository stopped updating. zipline-reloaded is the community-maintained continuation. The style is close to backtrader. It is a backtest library, so live trading is a separate problem. The licence is Apache-2.0.
- NautilusTrader: a Rust core with strategies in Python, built so the backtest and the live session share one codebase. The concepts are closer to a production trading system. Of these nine, it is the highest bar to a first strategy. The licence is LGPL-3.0.
- Lean: QuantConnect's open-source engine. Event-driven and modular, with backtests and live trading across several markets, and strategies in Python or C#. The official command-line tool runs local backtests, parameter optimization, and live trading in Docker. The licence is Apache-2.0.
- PyBroker: a backtesting framework aimed at machine-learning strategies. The licence matches vectorbt: Apache 2.0 with a Commons Clause.
08 · How to choose, by job
- First backtest, to learn the idea: backtrader. Move once the concept is clear.
- China futures, or a live connection: vnpy.
- Personal research on China A-shares: vnpy, or RQAlpha if the work stays non-commercial. Public China market data often starts with AKShare. The hands-on download is AKShare into SQLite. The same walkthrough in Chinese is in Chinese.
- Machine-learning stock selection: Qlib.
- Many parameter sets in one run: vectorbt.
- US stocks, classic event-driven style: zipline-reloaded. If backtest and live trading must share code, look at Lean or NautilusTrader.
- A company or a product you sell: read the licence column first. MIT and Apache-2.0 are the least restricted of this list. GPL, LGPL, a Commons Clause, and a non-commercial clause each need a reading before you ship.
Whichever you pick, a backtest is a reference, not a forecast. Leaving out fees and slippage, using data you would not have had at the time, or tuning until the history looks perfect will make the backtest kinder than a live account. After a backtest, paper trade. What that step has to show is on the beginner learning path. The walkthrough is paper trading after a backtest. The same article in Chinese is in Chinese.
The order around this choice, data first and an agent last, is how to choose AI quant tools. More engines are in the backtesting category. The wider job list is open-source tools by job.
Frequently asked questions
How to choose a backtesting framework?
Choose by market and by whether you need live orders, then by the licence and by whether anyone still maintains the project. There is no single best framework. backtrader is the usual first framework for learning the idea. vnpy fits China futures or a live connection. vectorbt fits a large parameter sweep. Qlib fits machine-learning stock selection.
Who it is for?
This guide is for someone who already writes a little Python and wants to install an open-source backtesting framework on their own computer. Use it to decide where to start for China A-share research, China futures, US stocks, or machine-learning stock selection.
Who it is not for?
This guide is not for someone who wants a hosted web platform to supply the data and the compute. It is not a comparison of broker terminals, and it is not a comparison of trading bots that send orders on their own. A backtesting framework checks a strategy. It does not open an account or replace a broker.
Is backtrader still a reasonable choice for a new project?
It is reasonable for learning how an event-driven backtest works. The repository has been quiet for a long time, so a compatibility break in Python or pandas is yours to fix. A project you expect to keep should start on a framework that is still maintained.
Can these frameworks be used in a commercial product?
Not all of them, and not on the same terms. vnpy and Qlib are MIT. zipline-reloaded and Lean are Apache-2.0. backtrader is GPL-3.0. NautilusTrader is LGPL-3.0. vectorbt and PyBroker are Apache 2.0 with a Commons Clause, so you can use them without paying but you cannot sell a product whose main feature is the library. RQAlpha's README limits use to non-commercial work. Read the project's own licence before you use one in a company.
This is not investment advice and not legal advice. Features and licences follow each project's own notice. A backtest is not a statement about future returns.