vectorbt PRO is a next-generation engine for backtesting, algorithmic trading, and research. It's a high-performance, actively-developed, proprietary successor to the vectorbt library, one of the world's most innovative open-source backtesting packages. The PRO version extends the open-source package with new impressive features and useful enhancements.
This tool is a community-led initiative to fix information asymmetry in trading. We bring many SOTA tools and libraries under one umbrella and automate them. Our vision is to make quantitative analysis and algorithmic trading accessible to everyone. Join us!
vectorbt PRO has been completely refactored to improve performance and enable new groundbreaking features, such as parallelization support.
vectorbt PRO enjoys priority in development and maintenance. All major enhancements will be exclusively and immediately available to all eligible sponsors.
vectorbt PRO provides a range of features and examples to make it more intuitive and easier to use. Our goal is to automate as many backtesting components as possible.
Join a Discord server with 200+ members to share ideas and help each other out. Get assistance faster and in more detail.
Get access to a range of exclusive articles and tutorials covering many aspects and best practices of using the library.
Regardless of whether you're a newbie or a seasoned programming prophet, you'll learn how to use the hottest Python tools to your own advantage in trading.
vectorbt PRO is powered by its community. Financial contributions like yours ensure that the software is safe to use for the years to come. Thanks!
What is vectorbt?¶
vectorbt is a Python package that combines a variety of acceleration and data science tools to make trading strategies and markets more transparent to quants.
One of the unique features of vectorbt is the ability to represent any trading setup as a set of multidimensional arrays, where each column represents a separate configuration of a trading strategy and its environment. This approach allows building and backtesting entire grids of parameters at the speed of C, while the results can be analyzed in detail using the Python's vibrant package ecosystem - the best of both worlds. Learn more.
vectorbt follows an approach totally opposite to that of a conventional backtesting software: instead of running a backtesting job as a single monolithic process, vectorbt divides the job into dozens of isolated components that can be composed by the user like Lego bricks and run independently of each other; such components include data, indicators, signals, allocations, portfolio, and more. Each component has its own ecosystem of analysis tools, enabling quants to analyze many facets of a trading strategy even before it hits the actual backtesting step. This also means that ML models can be connected at many places and integrated more easily.
Last but not least, vectorbt was build with parameter optimization in mind: even large spaces of parameters can be tested in the blink of an eye, allowing quants to build dashboards and explore how even a tiny change in parameters impacts the overall performance, in real time!
Pull daily history of the BTC/USDT and ETH/USDT pairs from Binance, backtest 20k configurations of the MACD indicator, and visualize the win rate as a function of the MACD parameters, in less than 30 seconds
import numpy as np import pandas as pd from itertools import combinations, product import vectorbtpro as vbt vbt.settings.set_theme("dark") @vbt.chunked( # (1)! size=vbt.LenSizer(arg_query='fastp'), arg_take_spec=dict( data=None, fastp=vbt.ChunkSlicer(), slowp=vbt.ChunkSlicer(), signalp=vbt.ChunkSlicer() ), merge_func=lambda x: pd.concat(x).vbt.sort_index(), show_progress=True, chunk_len=1000 # (2)! ) def pipeline(data, fastp, slowp, signalp): # (3)! macd = vbt.talib("MACD").run(data.get("Close"), fastp, slowp, signalp) entries = macd.macd_above(0) & macd.macd_above(macd.macdsignal) # (4)! exits = macd.macd_below(0) | macd.macd_below(macd.macdsignal) # (5)! pf = vbt.Portfolio.from_signals(data, entries, exits, freq='d') return pf.trades.win_rate btc_data = vbt.BinanceData.fetch(["BTCUSDT"]) # (6)! eth_data = vbt.BinanceData.fetch(["ETHUSDT"]) p = np.arange(4, 31) fastp, slowp, signalp = zip(*product(p, p, p)) # (7)! btc_win_rates = pipeline(btc_data, fastp, slowp, signalp) # (8)! eth_win_rates = pipeline(eth_data, fastp, slowp, signalp) win_rates = pd.concat((btc_win_rates, eth_win_rates)) # (9)! win_rates.vbt.volume( # (10)! slider_level="symbol", trace_kwargs=dict( colorscale="icefire", colorbar=dict(title='win_rate', tickformat='.0%'), cmid=0.5 ), ).show()
- Use chunking to reduce RAM consumption
- Process at most 1000 parameter combinations at a time
- Create a pipeline that returns the win rate for each parameter combination
- Enter a position whenever the MACD line is above zero and the signal line
- Exit the position whenever the MACD line is below zero or the signal line
- Fetch both datasets separately to avoid NaNs
- Generate 27 * 27 * 27 = 19683 parameter combinations. Since fast and slow periods are conditionally bound, we could (and should) have run the
itertools.combinationsinstead, but this would only colorize a half of the cube.
- Win rates of each chunk get concatenated into a single series
- Concatenate both series. They can still be destinguished by the index level "symbol".
- Plot a cube by making a slider out of the index level "symbol" and using three other index levels (our period parameters) as the X, Y, and Z axis.
What about overfitting? vectorbt PRO supports various cross-validation schemes and robustness tests to bring any backtest closer to reality. We don't recommend blindly selecting the best parameter set though: the main utility of this tool is to gain understanding of why a certain set of parameters yields a certain performance - we want you to advance as a quant after all.
What are prerequisites?¶
vectorbt PRO is not your average backtesting framework: instead of defining the entire logic in a single place and only having to deal with a limited set of commands supported by the framework, vectorbt is an open-end tool that forces you to adopt the data science approach to backtesting, that is, working with arrays, using third-party Python packages, building complex visualizations, and analyzing all kinds of artifacts along the way - a sometimes steep learning curve.
With great freedom comes great responsibility, and so at least some knowledge of Python and scientific computing is required. But even if you have neither, no need to worry: we'll help you through tutorials, documentation, and our vibrant community
How to get access?¶
vectorbt PRO is a private clone of vectorbt, hosted as a private GitHub repository. All new features are developed as part of this repository, which means that they are immediately and exclusively available to all eligible sponsors, as they are made collaborators of this repository.
Subscribe monthly. Cancel anytime. Limited time offer for early contributors. For individuals only.
$40$25 a month
Subscribe once and enjoy access forever! Limited time offer for early contributors. For individuals only.
$800$500 one time
To pay with crypto, please contact me at email@example.com
Grant commercial access for an organization. Please contact me at firstname.lastname@example.org
Starts at $500 a month
After receiving the payment, you'll be added as a collaborator to the private repository, invited to the private Discord server, and granted access to the private website with exclusive content
With each new milestone, the price will steadily increase to match that of competitors. By subscribing now, you will become an early contributor and secure this price to access all features that will follow!
What sponsorships achieve?¶
Sponsorships make this project sustainable, as they buy the maintainers of this project time – a very scarce resource – which is spent on the development of new features, bug fixing, stability improvement, issue triage and general support.
Have difficulties getting started or implementing your project? Contact email@example.com - he's offering professional help to organizations and individuals alike. You can also visit his YouTube channel (here) and the company website (here) to learn more about his work.