PyBroker vs LumiBot vs bt: free Python frameworks for backtesting strategies
PyBroker, LumiBot and bt are free Python frameworks for testing a trading idea on past data, but each is built for a different kind of idea. PyBroker is aimed at strategies that train a model and need an honest out-of-sample test; LumiBot uses the same strategy class for backtests, paper trading and live accounts; bt tests portfolio rules such as rebalancing and rotation. They are libraries, not ready-made bots, and a backtest is only a study of the past: it does not predict future returns. This side-by-side is built only from the facts on each tool's review page. Any example is illustrative.
Short answer
- PyBroker: Python users who train models and want walk-forward analysis and bootstrapped metrics instead of one lucky backtest (intermediate).
- LumiBot: Python developers who want the same strategy code to run in backtests, paper trading and, later, a broker account (intermediate).
- bt: Investors testing portfolio rules such as monthly rebalancing, momentum rotation or risk-based weighting, with configurable commissions (intermediate).
Want the next comparison in your pocket? Follow our free channel.
| PyBroker | LumiBot | bt | |
|---|---|---|---|
| Price | Free (source available) | Free (open source); a paid hosted service (BotSpot) also exists | Free (open source) |
| Cost model | Free | Free plan | Free |
| Open source | No | Yes | Yes |
| License | Apache 2.0 with Commons Clause (you may not sell it as a service) | GPL-3.0 | MIT |
| Level | Intermediate | Intermediate | Intermediate |
| Best for | Python users who train models and want walk-forward analysis and bootstrapped metrics instead of one lucky backtest (intermediate). | Python developers who want the same strategy code to run in backtests, paper trading and, later, a broker account (intermediate). | Investors testing portfolio rules such as monthly rebalancing, momentum rotation or risk-based weighting, with configurable commissions (intermediate). |
PyBroker
One of the few libraries that pushes you toward walk-forward testing and bootstrapped metrics, which is exactly what ML strategies need.
Best for: Python users who train models and want walk-forward analysis and bootstrapped metrics instead of one lucky backtest (intermediate).
Strengths
- Walk-forward analysis for model training and backtesting.
- Bootstrapped metrics to estimate how reliable the results are.
- Data from Alpaca, Yahoo Finance, AKShare or your own source; Optuna parameter optimization.
- Installs with pip (lib-pybroker) on Python 3.11 or later.
Good to know
- The Commons Clause forbids selling the software or services whose value derives substantially from it; it is not OSI open source.
- Machine-learning strategies overfit easily; walk-forward reduces but does not remove the risk.
LumiBot
A practical bridge from backtest to broker for Python users; ignore the AI hype and judge it as a framework.
Best for: Python developers who want the same strategy code to run in backtests, paper trading and, later, a broker account (intermediate).
Strengths
- 'lumibot demo' runs a backtest on free daily data without an API key or broker account.
- Same Strategy class for backtesting and live; broker configuration kept separate.
- Twelve broker integrations according to the project.
Good to know
- The AI template needs an OpenAI API key and billed model calls.
- Heavy marketing of 'AI agents that place the trade': an LLM decision is still an untested strategy until you backtest it properly.
- GPL-3.0 license: check the obligations if you redistribute modified code.
- Needs Python 3.10 or later. The README does not list the brokers, so check the broker catalog on the official website for yours.
bt
The right tool for testing allocation and rebalancing ideas, not for intraday trading signals.
Best for: Investors testing portfolio rules such as monthly rebalancing, momentum rotation or risk-based weighting, with configurable commissions (intermediate).
Strengths
- Strategies are composed from small algorithms: schedule, selection, weighting, rebalancing.
- Strategies can be nested into portfolio trees.
- Commissions and transaction cost models are configurable.
- Permissive MIT license.
- Active project (last commit on 31 October 2026).
Good to know
- You bring your own price data; results depend on its quality, as the README itself warns.
- Designed for portfolio-level backtests rather than order-by-order execution simulation.
Which one should you choose?
Pick bt if your idea is about how to allocate and rebalance a portfolio, PyBroker if your idea is a trained model that needs out-of-sample testing, and LumiBot if you want a path from backtest to a broker with one codebase. Check the licences before you build on them: bt is MIT, LumiBot is GPL-3.0, and PyBroker uses Apache 2.0 with the Commons Clause, so it is source available rather than OSI open source. Whatever you choose, include trading costs in the test, try paper trading first and set your own risk limits.
Quick answers
Which one is easiest to start with?
Levels: PyBroker (intermediate); LumiBot (intermediate); bt (intermediate). Start in a simulated or demo mode whenever the tool has one.
How much do they cost and what licence do they use?
PyBroker: Free (source available) (licence: Apache 2.0 with Commons Clause (you may not sell it as a service)). LumiBot: Free (open source); a paid hosted service (BotSpot) also exists (licence: GPL-3.0). bt: Free (open source) (licence: MIT). Prices change, so check the official websites before you decide.
What should I know before choosing?
PyBroker: The Commons Clause forbids selling the software or services whose value derives substantially from it; it is not OSI open source. LumiBot: The AI template needs an OpenAI API key and billed model calls. bt: You bring your own price data; results depend on its quality, as the README itself warns.
Guides that use these tools
Want a bot like this when custom bots open? Get notified · more bot ideas
Coming soon: custom bots
We are preparing a service to code, backtest and automate trading and statistics bots to your own rules. It is not available yet: follow our Telegram channel to know when it opens.