ScriptsJul 26, 2026·3 min read

vectorbt — High-Performance Quantitative Backtesting in Python

A Python library for fast backtesting, analysis, and visualization of trading strategies using vectorized operations on NumPy and pandas.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
vectorbt Overview
Direct install command
npx -y tokrepo@latest install d92390ad-890f-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

vectorbt is a Python library designed for quantitative traders and researchers who need to test thousands of strategy variations quickly. By leveraging NumPy broadcasting and vectorized operations instead of row-by-row iteration, it achieves orders-of-magnitude speedups over traditional event-driven backtesting frameworks, making exhaustive parameter sweeps practical.

What vectorbt Does

  • Runs vectorized backtests on trading strategies with minimal code
  • Computes portfolio performance metrics (Sharpe, Sortino, max drawdown, etc.) across parameter grids
  • Provides technical indicator wrappers (MA, RSI, BBANDS, etc.) with broadcasting support
  • Generates interactive Plotly-based visualizations of equity curves, drawdowns, and trade analysis
  • Supports multi-asset portfolio simulation with position sizing and fees

Architecture Overview

vectorbt represents data as multi-dimensional NumPy arrays where extra dimensions encode parameter combinations. Indicators, signals, and portfolio logic operate on these arrays using broadcasting, so a single backtest call can evaluate thousands of parameter sets simultaneously. The Portfolio class simulates order execution, tracks positions, and computes statistics. Numba JIT compilation accelerates custom logic where pure NumPy is insufficient.

Self-Hosting & Configuration

  • Install via pip install vectorbt with optional extras for data downloads
  • Use vbt.settings to configure global defaults for plotting, data caching, and computation
  • Set freq parameter on time series to ensure correct annualization of metrics
  • Enable Numba acceleration with @njit decorators for custom signal logic
  • Configure data sources via vbt.YFData, vbt.BinanceData, or custom data feeds

Key Features

  • Vectorized execution enables testing millions of parameter combinations in seconds
  • Built-in technical indicators that natively support parameter arrays
  • Interactive Plotly visualizations for equity curves, trade scatter plots, and heatmaps
  • Flexible portfolio simulation with configurable fees, slippage, and position sizing
  • Numba-accelerated custom indicators and signals

Comparison with Similar Tools

  • Backtrader — Event-driven, easier to understand but much slower for parameter sweeps
  • Zipline — Quantopian legacy framework; vectorbt is more flexible and actively maintained
  • bt — Tree-based strategy composition; vectorbt excels at brute-force parameter optimization
  • QuantStats — Analytics and reporting only; vectorbt includes the full backtest loop
  • pandas-ta — Indicator library only; vectorbt adds backtesting and portfolio simulation

FAQ

Q: How fast is vectorbt compared to event-driven frameworks? A: Depending on the strategy, vectorbt can be 100x to 1000x faster than row-by-row backtesters because it processes entire arrays at once.

Q: Can I use vectorbt for live trading? A: vectorbt is primarily a research and backtesting tool. For live trading, use its signal generation with a separate execution layer.

Q: Does vectorbt support cryptocurrency data? A: Yes. It includes built-in data downloaders for Yahoo Finance and Binance, and accepts any pandas DataFrame.

Q: What license does vectorbt use? A: vectorbt is released under a custom source-available license. Check the repository for details.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets