Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

vectorbt

> DevOps
Open source

The backtesting engine that gives you an unfair advantage. Run thousands of trading ideas before others finish one.

8.5K stars0 likes2 views
WebsiteGitHub

About

The backtesting engine that gives you an unfair advantage. Run thousands of trading ideas before others finish one.


</a>
<a href="https://pypi.org/project/vectorbt" title="PyPI">
    
</a>
<a href="https://pypi.org/project/vectorbt" title="Supported Python versions">
    
</a>
<a href="https://hub.docker.com/r/polakowo/vectorbt" title="Docker image version">
    
</a>
<a href="https://hub.docker.com/r/polakowo/vectorbt" title="Docker pulls">
    
</a>
<a href="https://github.com/polakowo/vectorbt/actions/workflows/tests.yml" title="Tests">
    
</a>
<a href="https://github.com/polakowo/vectorbt/actions/workflows/pypi.yml" title="PyPI release">
    
</a>
<a href="https://vectorbt.dev/" title="Website">
    
</a>
<a href="https://pypi.org/project/vectorbt-rust" title="Rust engine">
    
</a>
<a href="https://github.com/polakowo/vectorbt/blob/master/LICENSE.md" title="License">
    
</a>

Thinks in matrices, backtests at scale.

VectorBT takes a radically different approach to backtesting: instead of looping through bars one strategy at a time, it packs thousands of configurations into NumPy arrays, accelerates the hot path with Numba and Rust, and runs them all at once, turning hours of grid search into seconds.


Explore thousands of trading ideas across assets and timeframes, analyze portfolio performance down to individual trades, and visualize results interactively, all in a few lines of code. Built for both human researchers and AI agents, VectorBT combines large-scale experimentation with a mature, battle-tested backtesting stack refined through years of community use.

VectorBT is the open-source community edition of VectorBT PRO, a state-of-the-art hybrid backtesting library.

Features

  • Fast, vectorized backtesting and strategy research built on pandas, NumPy, and Numba
  • Optional Rust engine for precompiled speed without JIT overhead
  • Pandas-native API with custom accessors and high-performance operations
  • Flexible broadcasting for multi-asset analysis and large-scale parameter sweeps
  • Rich indicator ecosystem with custom indicators and integrations for TA-Lib, Pandas TA, and more
  • Portfolio backtesting with trade, drawdown, and performance analytics, including QuantStats integration
  • Signal tooling for generation, ranking, mapping, and distribution analysis
  • Built-in data access with preprocessing and synthetic data generation
  • Robustness testing with walk-forward optimization and label generation for ML workflows
  • Interactive visualization with Plotly, Jupyter widgets, and browser-friendly dashboards
  • Automation tools for scheduled updates and Telegram notifications
  • Composable Python API for rapid experimentation and AI agent-driven workflows

Installation

bash
pip install -U vectorbt

To install the optional Rust engine:

bash
pip install -U "vectorbt[rust]"

To install all optional integrations (TA-Lib, Pandas TA, etc.):

bash
pip install -U "vectorbt[full]"

To install all optional integrations together with the Rust engine:

bash
pip install -U "vectorbt[full,rust]"

Examples

Invest $100 in Bitcoin since 2014

python
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())
19501.10906763755

Trade a dual-SMA crossover strategy

python
fast_ma = vbt.MA.run(price, 10)
slow_ma = vbt.MA.run(price, 50)
entries = fast_ma.ma_crossed_above(slow_ma)
exits = fast_ma.ma_crossed_below(slow_ma)

pf = vbt.Portfolio.from_signals(price, entries, exits, init_cash=100)
print(pf.total_profit())
34417.80960086067

Generate 1,000 random strategies

python
import numpy as np

symbols = ["BTC-USD", "ETH-USD"]
data = vbt.YFData.download(symbols, missing_index="drop")
price = data.get("Close")

n = np.random.randint(10, 101, size=1000).tolist()
pf = vbt.Portfolio.from_random_signals(price, n=n, init_cash=100, seed=42)

mean_expectancy = pf.trades.expectancy().groupby(["randnx_n", "symbol"]).mean()
fig = mean_expectancy.unstack().vbt.scatterplot(xaxis_title="randnx_n", yaxis_title="mean_expectancy")
fig.show()

Test 10,000 dual-SMA window combinations

…

Inspect any strategy configuration

python
print(pf[(10, 20, "ETH-USD")].stats())
…

Plot any strategy configuration

python
pf[(10, 20, "ETH-USD")].plot().show()

Animate Bollinger Bands across multiple symbols

VectorBT goes beyond backtesting, with tools for financial data analysis and visualization:

…
100%|██████████| 31/31 [00:21<00:00,  1.21it/s]

Visit the website for more examples, documentation, and guides.

Example apps

Candlestick Patterns

Explore candlestick patterns interactively and backtest their signals with VectorBT.

Links

  • Website
  • Docker images
  • Colab notebook

License

This work is fair-code distributed under the Apache 2.0 with Commons Clause license.

The source code is publicly available, and everyone (individuals and organizations) may use it for free. However, you may not sell products or services that are primarily this software.

If you have questions or want to request a license exception, please contact the author.

Installing optional dependencies may be subject to a more restrictive license.

Star History

Disclaimer

This software is for educational purposes only. Do not risk money you cannot afford to lose.

Use the software at your own risk. The authors and affiliates assume no responsibility for your trading results.

Issues· 140 open

View all issuesOpen on GitHub
  • #822

    FX Convertion

    Updated Jun 12, 2026
  • #841

    Feature idea: Pattern similarity signals as vectorbt indicators

    Updated Apr 6, 2026
  • #42

    Feature request: Margin trades

    enhancementUpdated Mar 17, 2026
  • #831

    3.14 support request

    Updated Mar 13, 2026
  • #510

    Negative prices for spreads / pairs?

    Updated Feb 6, 2026
  • #748

    VectorBT - Telegram - Issue: ImportError: cannot import Unauthorized, ChatMigrated

    Updated Jan 8, 2026
  • #815

    Lightweight Charts as alternative plotting backend

    Updated Dec 24, 2025
  • #814

    Leverage implementation

    Updated Dec 23, 2025
  • #810

    Metric shows incorrect value in portfolio statistics

    Updated Nov 7, 2025
  • #807

    Can it support Python 3.13 version?

    Updated Nov 3, 2025

> Tags

Pythonalgorithmic-tradingalgorithmic-traidingbacktestingcryptocurrency

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理