3.5k stars · Apache-2.0 with Commons Clause · v2.0.1 (2026-08-28) · Track this in Scout
Walk-forward analysis and bootstrapped confidence intervals as first-class features — the anti-curve-fitting layer.
▶Repo detailsthe review · specs · pros & cons · install
What it is
A Python framework for backtesting rule-based and machine-learning trading strategies. You write a strategy as a function over bar data; it handles data sources, caching, position and portfolio bookkeeping and performance metrics. Its two distinguishing features are hooks for training and using a model inside the strategy, and walk-forward analysis with bootstrapped confidence intervals.What it is good for. Anyone testing a trading idea who wants to know whether it is real. The problem it removes is self-deception, which is the main way a backtest wastes a year of someone's life. For ScalpingMate, which tests EURUSD strategies against OANDA data, walk-forward analysis is the right shape of test: a scalping strategy tuned on one month and never checked on the next is not a strategy, it is a description of that month.
- Walk-forward testing and bootstrapped confidence intervals are built in, not bolted on. The honest test is the default one.
- Training a model inside the strategy is a first-class feature rather than something you assemble yourself.
- Results are cached, so re-running a long test after a small change is fast.
- The licence is Apache 2.0 with the Commons Clause, which means it is not open source in the usual sense: you may use it, but you may not sell the software itself. Read it before it goes anywhere near a paid product.
- The package is called
lib-pybrokeron PyPI, notpybroker. Installing the obvious name gets you something else. - It is built around bars, so it is a poor fit for anything that depends on the order book or on tick-by-tick timing. See the note on hftbacktest at the end of this edition.
kernc/backtesting.pyA deliberately small single-asset backtester with built-in parameter search and interactive charts, easier to start with but without walk-forward analysis as a first-class feature; AGPL-3.0.
Track this in Scout
nautechsystems/nautilus_traderRuns the identical strategy code in a backtest and in live trading, with a Rust core, so it is the production answer where PyBroker is the research one.
Track this in Scout- polakowo/vectorbt
Evaluates thousands of parameter combinations at once as array operations rather than a loop, which is far faster for sweeps; it carries the same Commons Clause restriction.
Track this in Scout
python3 -m venv venv && source venv/bin/activate pip install -U lib-pybroker # Python 3.11 or newer. Note the package name: lib-pybroker.
