skillfed

vectorbt

Python library for backtesting and analyzing trading strategies at scale

vectorbt v1.1.0 554.3K downloads/30d#6,036 on PyPI8,675
License unclear Active released

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 vectorbt

uv

uv add vectorbt

poetry

poetry add vectorbt

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: Financial and Insurance IndustryIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Office/Business :: FinancialTopic :: Scientific/Engineering :: Information AnalysisTopic :: Software Development

Tags

vectorized backtestingtrading strategy grid searchlarge-scale portfolio analysisfast strategy optimizationmulti-asset backtestingnumpy-based trading researchparallel strategy testing
backtestingtrading-researchvectorized-computation

More Software Development packages

Further reading