# VectorBT: Backtesting Thousands of Trading Strategies at Once

> VectorBT is a Python backtesting library that packs trading strategy configurations into NumPy arrays and evaluates them simultaneously using Numba and an optional Rust engine. Where a conventional backtesting loop processes one strategy configuration per run, VectorBT evaluates thousands in the same time.

**polakowo/vectorbt** — The backtesting engine that gives you an unfair advantage. Run thousands of trading ideas before others finish one.

- Repository: https://github.com/polakowo/vectorbt
- Website: https://vectorbt.dev
- Stars: 9,194 · Forks: 1,177
- Language: Python
- License: NOASSERTION
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/polakowo-vectorbt

## What VectorBT Does and Who It Is For

VectorBT takes a different architectural position than most Python backtesting libraries. Instead of stepping through time bars one at a time and evaluating a single strategy configuration per run, VectorBT represents strategies as arrays and evaluates all configurations simultaneously. The README summarizes this as: it packs thousands of configurations into NumPy arrays, accelerates the hot path with Numba and Rust, and runs them all at once.

The target user is a quantitative researcher or algorithmic trader who wants to answer questions like: across 10,000 dual-moving-average window combinations on three assets, which configurations produce the best risk-adjusted returns? Running that question with a loop-based backtester could take hours. VectorBT runs it in seconds by treating the parameter grid as a matrix operation.

The library is also positioned for ML workflows: the walk-forward optimization and label generation features support preparing training data for machine learning models applied to financial time series. It is not a live trading platform; it focuses on research and backtesting rather than execution.

## Vectorized Backtesting: How Arrays Replace Loops

The core insight is that a backtest over a time series can be expressed as a matrix operation rather than an event loop. Given price data for multiple assets, signal generation (a moving average crossover, for instance) produces Boolean arrays of entry and exit signals. VectorBT can broadcast those signals across many parameter combinations simultaneously using NumPy, then compute portfolio statistics on the results in bulk.

Numba is used for the computationally intensive inner loops. Numba compiles Python functions to machine code at runtime using LLVM. The first call to a Numba-compiled function incurs compilation overhead, but subsequent calls run at near-native speed. An optional Rust engine (the vectorbt-rust package, version-matched to the Python package) is available for workloads where Numba's JIT startup overhead is a concern.

The pandas-native API means VectorBT works directly with DataFrames and Series. Custom accessors add vectorbt methods to pandas objects, so operations like `price.vbt.scatterplot()` work naturally in a Jupyter notebook workflow.

## Installing VectorBT and Running a First Backtest

The base installation requires Python 3.11 or later (up to 3.14) and uses pip:

```sh
pip install -U vectorbt
```

To include the optional Rust engine for faster execution:

```sh
pip install -U "vectorbt[rust]"
```

To include all optional integrations including TA-Lib, yfinance, python-binance, ccxt, and QuantStats:

```sh
pip install -U "vectorbt[full]"
```

The simplest example from the README downloads Bitcoin price data and simulates a buy-and-hold position:

```python
import vectorbt as vbt

data = vbt.YFData.download("BTC-USD")
price = data.get("Close")

pf = vbt.Portfolio.from_holding(price, init_cash=100)
print(pf.total_profit())
```

A Docker image is published to Docker Hub at `polakowo/vectorbt`. The Dockerfile in the repository builds on the scipy-notebook Jupyter image and exposes port 8888, making it straightforward to run VectorBT in an isolated Jupyter environment.

## Parameter Sweeps at Scale

The README demonstrates testing 10,000 dual-SMA window combinations across three assets. The key method is `vbt.MA.run_combs()`, which generates all combinations of two moving average windows from a range and returns fast and slow MA objects that support vectorized crossover detection.

```python
windows = np.arange(2, 101)
fast_ma, slow_ma = vbt.MA.run_combs(price, window=windows, r=2, short_names=["fast", "slow"])
entries = fast_ma.ma_crossed_above(slow_ma)
exits = fast_ma.ma_crossed_below(slow_ma)

pf = vbt.Portfolio.from_signals(price, entries, exits, size=np.inf, fees=0.001, freq="1D")
```

The `pf` object here represents all 10,000 combinations across all three symbols simultaneously. Calling `pf.total_return()` returns a DataFrame with every result. Individual configurations are accessible with slice notation such as `pf[(10, 20, "ETH-USD")]`, and per-trade statistics are available through `pf.trades`.

This broadcasting model also supports random strategy generation. The README shows generating 1,000 random signal configurations in a few lines using `vbt.Portfolio.from_random_signals()`, which is a fast way to establish a random baseline for comparison.

## Community Edition vs. VectorBT PRO

VectorBT on GitHub is the open-source community edition. VectorBT PRO is a separate commercial product described at vectorbt.pro. The README documents differences explicitly.

Features absent from the community edition include limit order simulation, margin trading simulation, contract multipliers, random search for large parameter grids, conditional parameters that exclude invalid combinations (such as a fast MA window longer than the slow MA), cross-validation tools, and over 100 other capabilities according to the README. New PRO features are described as added weekly.

The community edition covers standard backtesting with market-order simulation, the full indicator ecosystem, the QuantStats integration, walk-forward optimization, and the Rust engine. For most research workflows that do not require order execution realism, the community edition is functionally complete.

Developers who need to evaluate PRO should consult vectorbt.pro/features/ and vectorbt.dev/getting-started/upgrade/ for the comparison documentation. The PRO pricing is not documented in the repository.

## Limitations of the Vectorized Approach

The vectorized model has a structural limit: it assumes market-order execution at the close price by default. Real trading involves slippage, partial fills, order book depth, and execution delays. The community edition does not model these. VectorBT PRO adds limit orders and margin trading support, but even there the simulation is an approximation, not a full market microstructure model.

Numba's JIT compilation adds startup time on the first run of a session. For exploratory work in a Jupyter notebook, this is a minor annoyance. For production workflows that cold-start frequently, the optional Rust engine addresses this, but it requires a separate package and version-matching between vectorbt and vectorbt-rust.

The Python version constraint of 3.11 to 3.14 means environments running older Python releases cannot use VectorBT v1.1.1. Teams on Python 3.10 or earlier need to upgrade before adoption.

The license field in the repository metadata shows NOASSERTION, meaning GitHub's automatic license classifier did not assign a standard identifier. The actual license terms are in the LICENSE.md file in the repository root. Developers who need to verify license compatibility with their use case should read that file directly.

## VectorBT vs. Backtrader

Backtrader is an event-driven Python backtesting framework that processes bars sequentially, one at a time. It is designed for strategies that need to react to events, manage positions conditionally, and maintain complex state across many bars. The API is object-oriented with Strategy subclasses and analyzers.

VectorBT processes all time steps simultaneously through array operations. This makes it orders of magnitude faster for parameter sweeps at the cost of expressiveness: strategies must be expressed as vectorized array operations, which rules out sequential decision logic that depends on arbitrary historical state.

The two tools address different workloads. Backtrader is the better choice for prototyping a complex strategy with conditional logic and order management. VectorBT is the better choice for exhaustive parameter optimization over a defined strategy type. Many quantitative researchers use both: VectorBT to find promising parameter regions quickly, and a more detailed simulator to validate the top candidates.

## License, Maintenance, and Python Compatibility

VectorBT v1.1.1 was released on 2026-09-26 and the last push to the repository was on the same date. The project is under active development. The previous major releases were v1.1.0 in July 2026 and v1.0.0 in April 2026, indicating a regular release cadence.

The license is stored in LICENSE.md in the repository root. GitHub reports the license as NOASSERTION, meaning it does not map to a recognized standard SPDX identifier. The pyproject.toml uses `license-files = ["LICENSE.md"]` rather than a standard `license` field with an SPDX expression. Developers who need to evaluate license compatibility for their use case should read LICENSE.md in the repository directly rather than relying on the GitHub metadata.

The Docker image is published at `polakowo/vectorbt` on Docker Hub, built from the Python 3.11 scipy-notebook base. The pyproject.toml specifies test dependencies including pytest, pytest-cov, and pytest-xdist, with a separate `test-rust` extra for running the Rust engine tests with maturin.

## Conclusion

VectorBT is the right choice for quantitative researchers and algorithmic traders who need to run large-scale parameter sweeps or test many strategy configurations quickly in Python. It is not the right choice for simulating strategies that require tick-by-tick order book logic, margin trading, or limit orders: those features belong to VectorBT PRO, the commercial extension. Before adopting VectorBT, verify that the license file at LICENSE.md in the repository is compatible with your intended use, since GitHub has classified the license as NOASSERTION, meaning the terms are not automatically clear from the standard identifier.

## FAQ

### What is VectorBT?

VectorBT is a Python backtesting library that evaluates trading strategies by packing configurations into NumPy arrays and processing them simultaneously using Numba and an optional Rust engine, rather than looping through time bars one strategy at a time.

### Is VectorBT free?

The VectorBT library on GitHub is the open-source community edition. VectorBT PRO, which adds limit orders, margin trading simulation, conditional parameter optimization, and over 100 other features, is a separate commercial product available at vectorbt.pro.

### Is VectorBT a reliable library for production research?

The README describes VectorBT as a battle-tested backtesting stack refined through years of community use. Version 1.1.1 was released on 2026-09-26 with active development continuing. The license terms are in LICENSE.md in the repository root and should be reviewed directly since GitHub classifies the license as NOASSERTION.

### How do I install VectorBT?

Run `pip install -U vectorbt` for the base package. Use `pip install -U "vectorbt[rust]"` to add the Rust engine, or `pip install -U "vectorbt[full]"` to include all optional integrations such as TA-Lib, yfinance, and QuantStats. Python 3.11 or later is required.

### How do I use VectorBT to backtest a strategy?

Import vectorbt, download price data with vbt.YFData.download() or another data source, generate entry and exit signal arrays, and pass them to vbt.Portfolio.from_signals(). Call methods like pf.total_return() or pf.stats() on the resulting Portfolio object to inspect results. The README provides worked examples.

## Sources

- [Issues](https://github.com/polakowo/vectorbt/issues)
- [polakowo/vectorbt on GitHub](https://github.com/polakowo/vectorbt)
- [Project website](https://vectorbt.dev)
- [README](https://github.com/polakowo/vectorbt/blob/master/README.md)
- [Releases](https://github.com/polakowo/vectorbt/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/polakowo-vectorbt
