- Platform
- Quantitative research and backtesting library
- License
- Apache-2.0 with Commons Clause
- Pricing
- Source-available package with no separate service fee
- Live trading
- No turnkey broker execution
- Best for
- Fast local signal research, multi-asset parameter exploration, and inspectable portfolio analysis
VectorBT is a source-available Python research library that represents strategy variants as labeled NumPy and pandas arrays. Vectorized operations, Numba, and optional Rust kernels handle the demanding work. It is useful when you want to compare signals, assets, and parameter combinations locally and inspect their orders, trades, drawdowns, and returns together.
VectorBT and VectorBT PRO are separate packages with related ideas. The community package imports as vectorbt. PRO imports as vectorbtpro and has its own APIs, source, license, docs, and many extra features. A PRO example does not necessarily work in VectorBT.
How VectorBT works
Traditional event-driven engines usually instantiate a strategy and advance it one event at a time. VectorBT can instead place assets and parameter combinations into columns of a larger array. One moving-average call, signal comparison, or portfolio constructor then processes many variants while pandas indexes preserve their identities.
Path-dependent accounting still has to run in sequence. VectorBT handles that work inside compiled portfolio kernels. The main simulation levels are:
Portfolio.from_signals()converts long and short entry or exit arrays into orders and can apply stop-loss, trailing-stop, and take-profit logic.Portfolio.from_orders()accepts size, price, direction, fee, and slippage arrays directly.Portfolio.from_order_func()invokes Numba-compiled callbacks that can inspect simulation context and generate orders as state changes.
The callback path is event-driven in execution order, but VectorBT remains an array-centered research system. Inputs normally exist before the simulation starts, and outputs become structured NumPy records wrapped by pandas-aware accessors.
What the community edition includes
| Area | Included capability | Important boundary |
|---|---|---|
| Parameter research | Broadcasting and IndicatorFactory, including Cartesian indicator combinations |
Memory grows with retained arrays and portfolio columns |
| Compute | NumPy, Numba, and optional precompiled Rust kernels | Rust supports selected deterministic array kernels, not arbitrary Python callbacks |
| Portfolio simulation | Orders, signals, compiled order callbacks, shorting, cash sharing, stops, fees, fixed fees, and slippage | No native limit-order, time-in-force, leverage, contract-multiplier, or continuation system comparable to PRO |
| Data | Yahoo Finance, Binance, CCXT, Alpaca, synthetic generators, updates, and alignment | Provider availability, entitlements, adjustments, and data quality remain external responsibilities |
| Indicators | Built-ins, custom factories, and parsers for TA-Lib, ta, and Pandas TA |
Optional packages must be installed separately, and library definitions can differ |
| Analysis | Order, log, trade, position, drawdown, return, and portfolio statistics with interactive Plotly views | Statistics inherit every data, timing, cost, and fill assumption in the simulation |
| Validation | Array splitting primitives, labels, and published walk-forward examples | Automated purging, embargoing, cross-validation factories, and parameterized split workflows are PRO features |
| Automation | Data updaters, scheduling, and Telegram notifications | This is not a maintained broker execution and reconciliation runtime |
The official feature inventory documents the community surface. For current installation extras and Docker images, use the installation guide.
Example: test a moving-average grid
This example constructs one synthetic daily series, forms all six ordered pairs from four moving-average windows, and simulates the six signal columns together. It selects Numba explicitly so the result does not depend on whether the optional Rust wheel is installed.
import numpy as np
import pandas as pd
import vectorbt as vbt
vbt.settings["engine"] = "numba"
index = pd.date_range("2026-01-01", periods=90, freq="D")
close = pd.Series(
100
+ np.linspace(0, 8, len(index))
+ 4 * np.sin(np.linspace(0, 10 * np.pi, len(index))),
index=index,
name="close",
)
windows = np.array([3, 5, 8, 12])
fast, slow = vbt.MA.run_combs(
close,
window=windows,
r=2,
short_names=["fast", "slow"],
)
entries = fast.ma_crossed_above(slow.ma)
exits = fast.ma_crossed_below(slow.ma)
portfolio = vbt.Portfolio.from_signals(
close,
entries,
exits,
init_cash=10_000,
fees=0.001,
slippage=0.0005,
freq="1D",
)
summary = pd.DataFrame(
{
"trades": portfolio.trades.count(),
"total_return_pct": portfolio.total_return() * 100,
}
)
print(summary.round(2).to_string())
Executed with VectorBT 1.1.0, it prints:
trades total_return_pct
fast_window slow_window
3 5 5 24.31
8 5 11.36
12 5 -2.68
5 8 5 4.18
12 4 -9.55
8 12 4 -18.10
The trend and oscillation were deliberately constructed, so these returns are not evidence of an edge. The useful result is the labeled fast_window and slow_window index, which lets a researcher inspect a response surface rather than lose each combination inside a Python loop. A real experiment also needs chronological out-of-sample testing and an account of every tried variant.
The optional Rust engine
Install matching Rust kernels with:
pip install -U "vectorbt[rust]"
The vectorbt-rust package is a PyO3 extension for Python. With the default auto setting, VectorBT uses Rust when the extension version is compatible and the call is supported, otherwise it falls back to Numba. engine="numba" forces the reference path. engine="rust" forces Rust and raises an error rather than falling back when the call is unsupported.
Randomized operations remain on Numba under auto to preserve their legacy random streams. Callback-accepting functions and unsupported input combinations also remain on Numba. Matching major and minor versions matter, and benchmark runs should use release builds. The Rust engine README explains dispatch and parity testing.
This Rust component is materially different from VBT PRO's native crate. Community vectorbt-rust builds a cdylib with required PyO3 and NumPy dependencies and is intended to accelerate the Python package. It is not a general native Rust API for building a Python-free strategy service. PRO's vectorbtpro-rust also builds an rlib and exposes native public builders, simulators, and streaming steppers.
Trading assumptions and research risks
VectorBT can express fees, fixed fees, percentage slippage, partial-fill constraints, rejection probabilities, order size limits, cash sharing, and stop signals. The defaults for fees and slippage are zero, so a run is frictionless unless the researcher changes them. Model spread, commissions, exchange or broker fees, funding, borrow costs, and liquidity outside the fields that directly match the strategy.
The engine cannot infer information missing from the input. A close-only series does not reveal the intrabar path. OHLC bars still do not reveal queue position, displayed depth changes, or counterfactual market impact. Stop behavior uses the supplied open, high, low, and close arrays and configured conflict rules. When a signal is calculated from a bar's close, shift it before execution unless the intended venue and decision timing genuinely make that price available. The portfolio documentation calls out this look-ahead risk.
Large array sweeps create a statistical risk as well as a memory cost. Testing thousands of variants and publishing the best one inflates false discoveries. Inspect neighborhoods, assets, regimes, and later periods, and connect the workflow to parameter robustness and explicit transaction-cost assumptions.
Data, indicators, and analysis
Provider classes currently include Yahoo Finance, Binance, CCXT, and Alpaca, plus synthetic geometric-Brownian-motion data. Integrations are conveniences, not bundled data rights. Persist the raw observation time, source, symbol mapping, adjustment policy, time zone, missing-data treatment, and package version if a result must be reproduced.
IndicatorFactory is one of the community edition's most reusable ideas. It wraps a calculation with named inputs, parameters, outputs, caching, broadcasting, and comparison helpers. Built-in indicators use the same conventions, and optional parsers bring third-party libraries into that labeled workflow. Always check definitions such as warm-up periods, smoothing, missing values, and adjustment behavior instead of treating indicators with the same name as identical.
Portfolio output is more than an equity curve. Structured order and log records feed trade and position objects, drawdowns, return accessors, stats(), and interactive plots. This makes VectorBT especially effective as an exploratory analysis environment, provided the underlying simulation assumptions remain visible.
License and maintenance
The repository is public and the package is free to install, but the controlling license is Apache 2.0 with the Commons Clause. The added clause removes the right to sell a product or service whose value derives substantially from VectorBT functionality. That means "source-available" or "fair-code" is more precise than calling it ordinary Apache-licensed open source. Review the actual terms for commercial distribution, hosting, consulting, or a derived service rather than relying on this summary as legal advice.
The project is not merely in community maintenance mode. The original author published the 1.0.0 and 1.1.0 lines in 2026, maintains current Python and dependency support, accepts contributions, and ships tests for both Numba and Rust paths. PRO receives a broader and faster-moving feature set, but that does not make the community package abandoned.
VectorBT or VectorBT PRO?
Choose VectorBT when local Python research, inspectable source, parameter grids, built-in stops, and core portfolio analysis cover the problem. It is a practical way to learn the array model and see whether that style fits your research without buying a membership.
VectorBT PRO extends this workflow with conditional parameters, purged and combinatorial cross-validation, distributed and resumable jobs, portfolio continuation, additional order and stop rules, portfolio optimization, MAE/MFE and other trade analysis, documentation tools, and native Rust strategies. These features reduce the amount of custom code needed as research grows. The official upgrade matrix lists the differences, and VectorBT PRO vs VectorBT explains where each edition fits.
Neither package supplies an exchange-grade order book or a turnkey live brokerage operation. Use an event-driven runtime such as Backtrader when strategy lifecycle and broker integration matter more than array-scale exploration, and validate any speed comparison on the real workload rather than treating a single benchmark as universal.
Bottom line
VectorBT is an actively maintained, source-available research library with labeled parameter grids, compiled portfolio accounting, detailed record analysis, and optional Rust speedups. It is best for broad signal research in Python. Its main limits are memory on very large grids, simplified market data, zero-cost defaults, the Commons Clause, and the extra work needed for purged validation and live trading.