vectorbt
Python library for backtesting and analyzing trading strategies at scale
What it is and what it does
VectorBT is a backtesting library that replaces traditional loop-based simulation with matrix operations: instead of running one strategy at a time through historical bars, it packs thousands of configurations into NumPy arrays and accelerates them with Numba (and optionally Rust), executing all variants in parallel. This approach trades sequential clarity for speed, turning parameter sweeps that would take hours into seconds.
The library is built on pandas, NumPy, and Numba, with 17 runtime dependencies including scipy, matplotlib, plotly, and scikit-learn. It provides portfolio analytics (trades, drawdowns, Sharpe ratio, Calmar ratio), signal generation and ranking, indicator ecosystems, walk-forward optimization, and interactive Plotly-based visualization. It's designed for both human researchers exploring trading ideas and AI agents automating strategy discovery.
Use it for:
- Test thousands of moving-average crossover parameter combinations across multiple assets and timeframes in minutes.
- Analyze portfolio performance metrics (win rate, profit factor, expectancy, Sharpe ratio) for individual strategy configurations.
- Generate and backtest random or synthetic trading signals to estimate strategy robustness and edge.
- Build walk-forward optimization pipelines for label generation and machine-learning-based strategy development.
- Visualize strategy results interactively with Plotly heatmaps, scatter plots, and animated indicator overlays.
- Download and preprocess market data from Yahoo Finance, then run portfolio simulations with fees and position sizing.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Vectorized backtesting engine that packs thousands of trading strategy configurations into NumPy arrays and runs them in parallel using Numba acceleration, turning grid searches into seconds instead of hours.
Yes, with conditions. Install if you need fast, large-scale strategy backtesting and can work with Python 3.11+. The low install friction, active maintenance, and strong community adoption make it reliable. However, verify the fair-code Apache 2.0 + Commons Clause license terms before using in commercial or proprietary products—the license treatment is flagged as unclear in the metadata.
Install
vectorbt on PyPI
pip
pip install vectorbtuv
uv add vectorbtpoetry
poetry add vectorbtInstalling vectorbt
Before you install
Low friction: pure Python wheel with no compiled dependencies required for the base install. Active maintenance with a recent release (40 days old) and strong community signal (8675 stars). Requires Python 3.11–3.14.
License in practice
License treatment is unclear in the metadata. The description mentions Apache 2.0 with Commons Clause (fair-code), which permits free use but restricts commercial redistribution—verify the actual license terms before use in proprietary or commercial contexts.
Quickstart
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())
Requires Python 3.11 or later. Optional Rust engine available via pip install vectorbt[rust] for precompiled speed.
Verify before relying
- Actual license terms and commercial use restrictions under the fair-code Apache 2.0 + Commons Clause model
- Performance characteristics and memory footprint when testing thousands of strategy configurations
- Compatibility and integration depth with TA-Lib and Pandas TA mentioned in the description
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (<3.15,>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 17 — numpy, pandas, scipy, matplotlib, plotly, ipywidgets, anywidget, numba, dill, tqdm, dateparser, imageio, scikit-learn, schedule, requests, pytz, mypy_extensions |
| Maintenance | actively maintained — 40 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 554,274/month — #6,036 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: vectorbt-1.1.0-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
backtestingBacktesting.py lets you define and test trading…
agpl · top 15,000 on PyPI
finlabBacktest trading strategies on Taiwan stock…
copyleft · top 15,000 on PyPI
backtraderBacktrader is a Python backtesting and live…
copyleft · top 15,000 on PyPI
nautilus_traderNautilusTrader is a Rust-native event-driven…
copyleft · top 15,000 on PyPI
pandas-taProvides over 150 technical analysis indicators…
unclear · top 5,000 on PyPI
riskfolio-libRiskfolio-Lib builds optimized investment…
permissive · top 15,000 on PyPI
lumibotLumibot is a Python framework for building,…
permissive · top 15,000 on PyPI
freqtradeFreqtrade is a Python-based cryptocurrency…
copyleft · top 15,000 on PyPI
ft-pandas-taProvides 130+ technical analysis indicators and…
permissive · top 15,000 on PyPI
pandas-ta-classicPandas TA Classic provides 193 technical…
permissive · top 15,000 on PyPI