BacktestScore

Backtesting.py review (2026)

Lightweight open-source Python library for backtesting single-instrument strategies

7.1Overall / 10

Best for: Beginner-to-intermediate Python traders who want the fastest path from strategy idea to a credible single-instrument backtest with interactive charts, without paying anything or learning a heavyweight framework.

Power
5.8
Ease of use
9.2
Data quality
5.5
Value for money
9.3

Editorial scores per our methodology. Affiliate status has zero weight.

Verdict

Backtesting.py is the closest thing Python has to a "just works" backtesting library. You feed it a pandas DataFrame of OHLCV candles, subclass Strategy with an init() and a next() method, and get a full statistics table plus an interactive Bokeh chart in a handful of lines. That economy of API is the product. Nothing else in the Python ecosystem gets a newcomer from idea to first backtest faster, and at $0 under an open-source license the cost of trying it is zero.

The trade-off is scope. The library simulates one instrument per backtest, offers no live trading, ships no data, and models orders at a basic level. Serious multi-asset portfolio research belongs in VectorBT, Zipline Reloaded, or QuantConnect; production execution belongs elsewhere entirely. For years the bigger worry was abandonment, with no releases between December 2021 and January 2025. The project has since revived convincingly: nine releases through v0.6.6 (July 2026) added fractional trading, a multi-dataset runner, spread and commission modeling, and the SAMBO optimizer.

We score it 7.1/10: elite ease of use and cost-value, mid-pack power. It sits above the now-dormant Backtrader (6.8) on maintenance and approachability, and below VectorBT (7.8), which trades simplicity for far more analytical firepower.

Pros

  • +Completely free and open-source (AGPL-3.0) with no paid tiers or usage limits
  • +Arguably the simplest API of any Python backtesting framework: a working strategy fits in ~20 lines
  • +Actively maintained again: nine releases from v0.4.0 (Jan 2025) to v0.6.6 (Jul 2026) after a three-year dormancy
  • +Interactive Bokeh equity/trade charts generated with one plot() call
  • +Built-in parameter optimizer (grid search with multiprocessing plus SAMBO model-based search) with optimization heatmaps
  • +Market-agnostic: works on any OHLCV series (stocks, forex, crypto, futures) at any bar interval
  • +Interoperates with TA-Lib, Tulip, and pandas-ta for indicators; recent versions added FractionalBacktest, MultiBacktest, trailing stops, spread modeling, and commission tracking

Cons

  • One instrument per backtest, so no portfolio or multi-asset strategies (MultiBacktest only repeats a strategy across separate datasets)
  • No live trading or broker integrations; it is a research tool only
  • No bundled historical data beyond tutorial sample sets: data sourcing is entirely on you
  • OHLC bars only: no native tick data, order-book depth, fundamentals, or options chains
  • No built-in walk-forward analysis; must be hand-rolled around the optimizer
  • Order modeling is basic (market/limit/stop with SL/TP); complex strategies require documented workarounds
  • AGPL-3.0 copyleft can complicate embedding in commercial hosted products
  • Development depends largely on a single maintainer, and the 2022-2024 gap shows the bus-factor risk

Backtesting.py at a glance

Engine typehybrid
Asset classesstocks, forex, crypto, futures, any instrument with OHLC(V) candlestick data
LanguagesPython
Bundled dataNone beyond bundled sample datasets (GOOG daily, EURUSD intraday) used in tutorials. You bring your own OHLCV data as pandas DataFrames from yfinance, ccxt, broker APIs, or paid vendors
Finest resolutionAny OHLC bar interval you supply, including sub-minute bars; raw tick or order-book data must be resampled to candles first
Live tradingNo
Options supportNo
Walk-forward testingNo
Open sourceYes
Runs onWindows, macOS, Linux, Jupyter notebooks (Python 3.9+)

Backtesting.py pricing (2026)

PlanPriceIncludes
Open source (only tier)$0Full library via `pip install backtesting`; AGPL-3.0 license; no feature gates, seats, or usage limits

Backtesting.py is entirely free open-source software under AGPL-3.0. There is no paid tier, cloud edition, or commercial license for sale as of August 2026 (verified on the official docs site and GitHub repo). The project accepts voluntary donations via GitHub Sponsors. Practical costs are indirect: you supply your own market data (free via yfinance/ccxt or paid vendors) and your own compute. Note the AGPL-3.0 copyleft: if you embed the library in a network-accessible service, you must offer your service's source to its users. That matters to commercial SaaS builders and is irrelevant for personal research use.

Prices last verified: 2026-08-04

What it is

Backtesting.py is a free, open-source Python library (AGPL-3.0) created by Slovenian developer kernc, hosted on GitHub with roughly 8.8k stars and 1.5k forks as of August 2026. Installed with pip install backtesting, it backtests trading strategies on any financial instrument for which you have OHLC(V) candlestick data: stocks, forex, crypto, or futures. It requires Python 3.9+ and builds on pandas, NumPy, and Bokeh.

The design philosophy is minimalism. A strategy is a small class with two methods; indicators are declared in init() (vectorized over the whole series) and trading logic runs bar-by-bar in next(). Results come back as a pandas Series of ~40 statistics (Sharpe, CAGR, max drawdown, Kelly criterion, alpha/beta versus the market) plus per-trade DataFrames.

After a three-year dormancy that pushed many users toward forks like lucit-backtesting, the original project resumed active development in January 2025. Releases 0.4.0 through 0.6.6 (July 2026) added the SAMBO optimizer, FractionalBacktest for sub-unit crypto position sizes, MultiBacktest for running one strategy across many datasets, percentage trailing stops, bid-ask spread modeling, and commission tracking in trade statistics. There is no company behind it and nothing to buy. Funding is voluntary GitHub Sponsors donations.

Backtesting engine & accuracy

The engine is a hybrid by the project's own description. Indicators are computed vectorized up front, then the simulation steps through bars event-style, which keeps execution fast while letting logic react to state (open positions, equity) the way a purely vectorized engine cannot. On the daily-bar tutorial datasets a run completes in milliseconds. Grid optimization uses multiprocessing with shared memory, and the SAMBO model-based optimizer (added in 0.5.0) searches large parameter spaces more sample-efficiently than brute force.

Accuracy is respectable for bar-level research but bounded by bar-level assumptions. Orders fill at the next bar's open by default (avoiding the most common look-ahead trap), and the engine supports commissions, bid-ask spread (added in 0.6.0), stop-loss/take-profit brackets, and margin/leverage. It does not model queue position, partial fills, order-book depth, or slippage beyond a fixed spread/commission. A GitHub discussion notes users doubling TradingView-level commissions to reconcile results, which shows how cost assumptions dominate at this fidelity. Intra-bar SL/TP sequencing is inferred from OHLC, so it can be optimistic on volatile bars unless you feed finer-grained candles.

The optimizer returns heatmaps that make overfitting visible, but there is no built-in walk-forward or combinatorial cross-validation: you must script train/test splits yourself. For single-instrument, bar-resolution strategy research, the results are as trustworthy as your data and cost assumptions.

Data

Backtesting.py ships no market data. The package bundles only small tutorial datasets (daily Google stock and intraday EURUSD samples) so the documentation examples run out of the box. Everything else is bring-your-own. Any pandas DataFrame with Open/High/Low/Close (and optionally Volume) columns works, at any bar interval: daily, hourly, minute, or finer. Tick data must be resampled into candles first.

In practice, users pull free data from yfinance for equities, ccxt or exchange APIs for crypto, and broker exports or paid vendors (Polygon, Databento, Dukascopy) for intraday and forex data. Because the input is just a DataFrame, no adapter layer is required. That is a genuine advantage over frameworks with rigid data-feed abstractions, but it also means data cleaning (gaps, splits, dividends, timezone alignment) is entirely your responsibility, and dividend-adjusted total-return backtests require you to pre-adjust the series yourself.

There are no integrated data downloaders of the kind VectorBT provides, no point-in-time fundamentals, and no corporate-action handling. For indicators, the library computes anything you can express as a NumPy/pandas function and interoperates cleanly with TA-Lib, Tulip, and pandas-ta. Our data score reflects this: maximal flexibility, minimal batteries included.

Pricing breakdown

There is nothing to price-compare: Backtesting.py costs $0, full stop. No free-tier limits, no pro edition, no cloud service, no license keys. We verified that on the official documentation site, PyPI, and the GitHub repository in August 2026. The maintainer accepts optional GitHub Sponsors donations.

The one "cost" worth understanding is the license. AGPL-3.0 is a strong copyleft. You own your strategies outright and can trade them commercially without obligation, but if you build a network-accessible service (for example, a hosted backtesting SaaS) on top of the library, the AGPL requires you to offer that service's source code to its users. Individual quants and prop-desk researchers are unaffected. Startups embedding it in a product should read the license carefully or architect around it.

Total cost of ownership is therefore dominated by data and time. A realistic free stack (yfinance daily data plus Backtesting.py) costs nothing; a serious intraday stack might add $30-$200/month in vendor data fees, and those costs would apply to any BYO-data library. Against subscription platforms charging $30-$120/month for comparable single-instrument backtesting, the cost-value here is close to unbeatable, which our 9.3 cost-value score reflects.

Who it's for

Choose Backtesting.py if you are a Python-literate retail trader testing directional strategies on one instrument at a time: a moving-average system on BTC, a breakout strategy on EURUSD, a mean-reversion idea on SPY. It is the best first backtesting library in Python. The API teaches correct habits (next-bar fills, explicit costs, optimization heatmaps that expose overfitting) without framework ceremony, and the interactive charts make debugging a strategy's behavior unusually concrete.

It also serves experienced quants as a rapid-prototyping scratchpad: many use it to sanity-check an idea in ten minutes before committing to a heavier research stack.

Look elsewhere if you need portfolio-level logic (position sizing across correlated assets, sector rotation, pairs trading). That is VectorBT or Zipline Reloaded territory. If you want an integrated path from backtest to live execution, QuantConnect or NautilusTrader are built for exactly that. Options traders are out of scope entirely: there is no chain, greeks, or expiration modeling. And if you cannot or will not code Python, this library offers nothing; TradingView is the usual no-code alternative. Finally, commercial SaaS builders should weigh the AGPL license before embedding it.

Backtesting.py

Lightweight open-source Python library for backtesting single-instrument strategies

Visit Backtesting.pyMay be an affiliate link. Disclosure

Frequently asked questions

Is Backtesting.py free?+

Yes, completely. It is open-source software under the AGPL-3.0 license with no paid tiers, feature gates, or usage limits. Install it with `pip install backtesting`. The project is funded only by voluntary GitHub Sponsors donations. Your real costs are market data and your own time.

Is Backtesting.py still maintained in 2026?+

Yes. After a dormant stretch from December 2021 to January 2025, development resumed: versions 0.4.0 through 0.6.6 shipped between January 2025 and July 2026, adding the SAMBO optimizer, fractional trading, multi-dataset backtesting, spread modeling, and commission statistics. It remains largely a single-maintainer project, which is the main long-term risk.

How accurate is Backtesting.py?+

Accurate at bar-level fidelity if configured honestly. Orders fill at the next bar's open by default (avoiding look-ahead bias), and you can model commissions, bid-ask spread, leverage, and SL/TP brackets. It does not simulate order-book depth, partial fills, or dynamic slippage, and intra-bar stop sequencing is inferred from OHLC. Results on volatile intraday strategies are only as reliable as your bar resolution and cost assumptions.

Can Backtesting.py trade multiple assets or a portfolio?+

No, and this is its biggest limitation. Each backtest simulates exactly one instrument. The MultiBacktest utility (added in v0.6.3) runs the same strategy across several datasets independently, but there is no shared capital, cross-asset signaling, or portfolio rebalancing. For portfolio strategies, use VectorBT, Zipline Reloaded, or QuantConnect.

Does Backtesting.py support live trading?+

No. It has no broker integrations and no execution engine; it is purely a research/backtesting tool. Traders typically re-implement validated strategies in a live framework (NautilusTrader, QuantConnect, broker APIs). That manual port introduces risks of its own.

Backtesting.py vs Backtrader: which should I use?+

Backtesting.py is simpler, faster to learn, and actively maintained (last release July 2026), but single-asset and backtest-only. Backtrader is more powerful, with multi-asset portfolios and live trading via brokers, yet it has been effectively unmaintained since around 2023. For solo research on one instrument, Backtesting.py; for portfolio logic on a legacy stack, Backtrader; for performance-heavy portfolio research, VectorBT.

Can I use Backtesting.py commercially?+

Yes, with a caveat. You own any strategies you build and can trade them commercially without restriction. However, AGPL-3.0 is a network copyleft: if you embed the library in a hosted service, you must offer that service's source code to its users. Personal and internal desk use is unaffected.

Alternatives to Backtesting.py

Or see the head-to-head pages:Backtesting.py vs VectorBT, Backtesting.py vs Backtrader, Backtesting.py vs Zipline Reloaded, Backtesting.py vs QuantConnect

Sources

  • https://kernc.github.io/backtesting.py/
  • https://github.com/kernc/backtesting.py
  • https://pypi.org/pypi/Backtesting/json
  • https://github.com/kernc/backtesting.py/blob/master/CHANGELOG.md
  • https://github.com/kernc/backtesting.py/blob/master/LICENSE.md
  • https://github.com/kernc/backtesting.py/discussions/734
  • https://algotrading101.com/learn/backtesting-py-guide/
  • https://www.interactivebrokers.com/campus/ibkr-quant-news/backtesting-py-an-introductory-guide-to-backtesting-with-python/

Educational content only, not investment advice. Spot an outdated price or spec? The data behind this page is open; see our editorial policy.