VectorBT — Lightning-Fast Vectorized Backtesting for Python

VectorBT takes a fundamentally different approach to backtesting: instead of processing bars one at a time (event-driven), it uses vectorized NumPy/Numba operations to run thousands of backtests simultaneously. The result is 100-1000x faster performance than frameworks like Backtrader — making it ideal for research, parameter sweeps, and ML workflows.

Language: Python | License: Apache 2.0 + Commons Clause | GitHub Stars: ~7K


Key Features

  • Vectorized execution via NumPy and Numba JIT — orders of magnitude faster
  • Pandas-native API with custom accessors (df.vbt.signals, etc.)
  • Test thousands of parameter combinations in seconds
  • Multi-asset portfolio backtesting
  • Built-in data downloaders — Yahoo Finance, CCXT (100+ crypto exchanges), Alpaca, Binance
  • Interactive Plotly charts — better than matplotlib, on par with Bokeh
  • Comprehensive analytics — trades, positions, drawdowns, returns
  • Jupyter notebook integration
  • Walk-forward optimization support
  • ML workflow compatibility — fits naturally into scikit-learn/pandas pipelines

Quick Start Example

import vectorbt as vbt

# Download data
price = vbt.YFData.download('BTC-USD', start='2020-01-01').get('Close')

# Generate all SMA crossover combinations at once
fast_ma = vbt.MA.run(price, window=range(10, 50, 5))
slow_ma = vbt.MA.run(price, window=range(20, 100, 10))

# Generate entry/exit signals for every combination
entries = fast_ma.ma_crossed_above(slow_ma)
exits = fast_ma.ma_crossed_below(slow_ma)

# Run ALL backtests simultaneously
pf = vbt.Portfolio.from_signals(price, entries, exits, init_cash=10000)

# Analyze results
print(pf.total_return())
pf.plot().show()

This code tests every combination of fast (10-45) and slow (20-90) moving average periods in a single vectorized operation. With event-driven frameworks, you’d need a nested loop running each backtest sequentially.

The Vectorized Paradigm

Traditional backtesting frameworks iterate through each bar:

for each bar in data:
    update indicators
    check signals
    execute orders

VectorBT computes everything at once across the entire dataset:

indicators = compute_all_indicators(data)     # one operation
signals = compute_all_signals(indicators)      # one operation
portfolio = simulate_all_trades(signals)       # one operation

This is why it’s 100-1000x faster for parameter optimization and multi-asset testing. The tradeoff: complex stateful logic (position-dependent decisions, dynamic order sizing) is harder to express in vectorized form.

Data Sources

  • Yahoo Finance — built-in via vbt.YFData
  • CCXT — 100+ crypto exchanges, built-in
  • Alpaca — US equities, built-in
  • Binance — crypto, built-in
  • Any Pandas DataFrame or NumPy array
  • PRO version has additional data connectors

Pros

  • Extremely fast — the fastest Python backtesting framework by a wide margin
  • Massive parameter spaces tested in seconds, not hours
  • Pandas-native — feels natural for data scientists and quants
  • Excellent Plotly charts — interactive and publication-quality
  • Great for research and exploratory analysis
  • Multi-asset out of the box
  • Built-in data downloaders reduce setup friction
  • Works for both crypto and traditional markets

Cons

  • Vectorized paradigm limits strategy complexity — stateful logic is harder
  • Commons Clause license — free for personal/commercial use, but you can’t sell products primarily based on VectorBT
  • No built-in live trading
  • PRO version pricing is opaque (contact for quote)
  • Steeper learning curve if you’re used to event-driven frameworks
  • Memory-intensive — materializes full arrays, so very large datasets can exhaust RAM
  • Documentation can be sparse for advanced features
  • Smaller community than Backtrader

Pricing

TierPriceDetails
vectorbt (open-source)FreeApache 2.0 + Commons Clause (“Fair Code”)
vectorbt PROContact for pricingAdvanced portfolio optimization, signal generation, extended data, priority support

The Commons Clause means: free for personal and commercial use, but you cannot sell a product where VectorBT is the primary value. For most users, this is effectively free.

Community & Support

  • ~7,000 GitHub stars, ~725 dependent projects
  • Active GitHub Discussions
  • Growing presence in quant and data science communities
  • Actively maintained — last release March 2026 (v0.28.5)

Who Should Use VectorBT?

VectorBT is the right choice if speed is your priority — parameter optimization, walk-forward analysis, or ML feature generation across many assets. Data scientists and quants who think in Pandas/NumPy will feel at home.

If you need complex stateful strategies (dynamic position sizing, portfolio rebalancing logic), event-driven frameworks like Backtrader or QuantConnect are better suited. If you want simplicity and great charts for single-instrument testing, try Backtesting.py. For crypto with live trading, Freqtrade is the complete solution.

Resources