vectorbt 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vectorbt-1.2.2/MANIFEST.in +2 -0
- {vectorbt-1.2.0/vectorbt.egg-info → vectorbt-1.2.2}/PKG-INFO +89 -47
- {vectorbt-1.2.0 → vectorbt-1.2.2}/README.md +87 -45
- {vectorbt-1.2.0 → vectorbt-1.2.2}/pyproject.toml +1 -1
- vectorbt-1.2.2/tests/__init__.py +0 -0
- vectorbt-1.2.2/tests/conftest.py +144 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_base.py +378 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_data.py +456 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_engine.py +169 -1
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_generic.py +167 -5
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_indicators.py +312 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_portfolio.py +210 -38
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_records.py +3 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_returns.py +167 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_utils.py +92 -1
- vectorbt-1.2.2/tests/utils.py +61 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/_version.py +1 -1
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/index_fns.py +92 -34
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/reshape_fns.py +21 -6
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/data/base.py +23 -5
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/data/custom.py +16 -2
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/nb.py +118 -38
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/factory.py +9 -3
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/nb.py +73 -12
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/base.py +6 -5
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/enums.py +4 -1
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/nb.py +25 -3
- vectorbt-1.2.2/vectorbt/py.typed +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/mapped_array.py +5 -5
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/accessors.py +87 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/dispatch.py +49 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/nb.py +100 -3
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/array_.py +1 -1
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/config.py +5 -2
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/datetime_.py +10 -3
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/params.py +12 -3
- {vectorbt-1.2.0 → vectorbt-1.2.2/vectorbt.egg-info}/PKG-INFO +89 -47
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt.egg-info/SOURCES.txt +4 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt.egg-info/requires.txt +1 -1
- vectorbt-1.2.0/MANIFEST.in +0 -1
- {vectorbt-1.2.0 → vectorbt-1.2.2}/LICENSE.md +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/setup.cfg +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/setup.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_labels.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_plotting.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_settings.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/tests/test_signals.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/_engine.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/_settings.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/_typing.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/array_wrapper.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/column_grouper.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/combine_fns.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/base/indexing.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/data/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/data/updater.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/decorators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/drawdowns.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/enums.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/plots_builder.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/plotting.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/ranges.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/splitters.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/generic/stats_builder.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/basic.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/configs.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/indicators/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/labels/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/labels/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/labels/enums.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/labels/generators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/labels/nb.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/messaging/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/messaging/telegram.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/ohlcv_accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/decorators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/logs.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/orders.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/portfolio/trades.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/px_accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/base.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/col_mapper.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/decorators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/records/nb.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/metrics.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/returns/qs_adapter.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/root_accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/accessors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/dispatch.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/enums.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/factory.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/generators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/signals/nb.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/templates/dark.json +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/templates/light.json +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/templates/seaborn.json +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/__init__.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/attr_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/checks.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/colors.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/decorators.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/docs.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/enum_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/figure.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/image_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/mapping.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/math_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/module_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/random_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/requests_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/schedule_.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/tags.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt/utils/template.py +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt.egg-info/dependency_links.txt +0 -0
- {vectorbt-1.2.0 → vectorbt-1.2.2}/vectorbt.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vectorbt
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python library for backtesting and analyzing trading strategies at scale
|
|
5
5
|
Author-email: Oleg Polakow <olegpolakow@vectorbt.pro>
|
|
6
6
|
Project-URL: Homepage, https://github.com/polakowo/vectorbt
|
|
@@ -38,7 +38,7 @@ Requires-Dist: requests
|
|
|
38
38
|
Requires-Dist: pytz
|
|
39
39
|
Requires-Dist: mypy_extensions
|
|
40
40
|
Provides-Extra: rust
|
|
41
|
-
Requires-Dist: vectorbt-rust==1.2.
|
|
41
|
+
Requires-Dist: vectorbt-rust==1.2.2; extra == "rust"
|
|
42
42
|
Provides-Extra: full
|
|
43
43
|
Requires-Dist: TA-Lib; extra == "full"
|
|
44
44
|
Requires-Dist: yfinance>=0.2.22; extra == "full"
|
|
@@ -124,13 +124,13 @@ Dynamic: license-file
|
|
|
124
124
|
<a href="#links">Links</a>
|
|
125
125
|
</p>
|
|
126
126
|
|
|
127
|
-
<
|
|
127
|
+
<h2 align="center">Trading research at scale.</h2>
|
|
128
128
|
|
|
129
|
-
<p align="center">VectorBT
|
|
129
|
+
<p align="center">VectorBT is a Python toolkit for trading research. Explore market data, build indicators and signals, and compare thousands of ideas across assets and timeframes. NumPy arrays, Numba acceleration, and an optional Rust engine let you run large experiments in a few lines of Python.</p>
|
|
130
130
|
|
|
131
131
|
---
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
Move from exploring price patterns to evaluating strategies in one workflow. Inspect trades, fees, drawdowns, and portfolio performance, then explore the results with interactive charts. Built for traders, researchers, and AI agents, VectorBT brings data analysis, strategy simulation, and visualization together in a composable Python API.
|
|
134
134
|
|
|
135
135
|
VectorBT is the open-source community edition of [VectorBT PRO](https://vectorbt.pro/).
|
|
136
136
|
PRO extends the library with parallelization, additional data integrations, portfolio optimization,
|
|
@@ -145,62 +145,74 @@ See [VectorBT vs PRO](https://vectorbt.dev/getting-started/upgrade/) or browse
|
|
|
145
145
|
<table>
|
|
146
146
|
<tr>
|
|
147
147
|
<td width="50%" valign="top">
|
|
148
|
-
<
|
|
149
|
-
Research strategies at scale with pandas, NumPy, and Numba.</p>
|
|
148
|
+
<h3>Fast, vectorized backtesting</h3>
|
|
149
|
+
<p>Research strategies at scale with pandas, NumPy, and Numba.</p>
|
|
150
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#fast-vectorized-backtesting">Backtesting examples →</a></p>
|
|
150
151
|
</td>
|
|
151
152
|
<td width="50%" valign="top">
|
|
152
|
-
<
|
|
153
|
-
Use precompiled kernels for supported operations without JIT compilation.</p>
|
|
153
|
+
<h3>Optional Rust engine</h3>
|
|
154
|
+
<p>Use precompiled kernels for supported operations without JIT compilation.</p>
|
|
155
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#optional-rust-engine">Rust engine →</a></p>
|
|
154
156
|
</td>
|
|
155
157
|
</tr>
|
|
156
158
|
<tr>
|
|
157
159
|
<td width="50%" valign="top">
|
|
158
|
-
<
|
|
159
|
-
Work with custom accessors and high-performance operations directly on pandas objects.</p>
|
|
160
|
+
<h3>Pandas-native API</h3>
|
|
161
|
+
<p>Work with custom accessors and high-performance operations directly on pandas objects.</p>
|
|
162
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#pandas-native-api">Pandas integration →</a></p>
|
|
160
163
|
</td>
|
|
161
164
|
<td width="50%" valign="top">
|
|
162
|
-
<
|
|
163
|
-
Analyze multiple assets and sweep large parameter grids with flexible array broadcasting.</p>
|
|
165
|
+
<h3>Flexible broadcasting</h3>
|
|
166
|
+
<p>Analyze multiple assets and sweep large parameter grids with flexible array broadcasting.</p>
|
|
167
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#flexible-broadcasting">Broadcasting API →</a></p>
|
|
164
168
|
</td>
|
|
165
169
|
</tr>
|
|
166
170
|
<tr>
|
|
167
171
|
<td width="50%" valign="top">
|
|
168
|
-
<
|
|
169
|
-
Build custom indicators and use integrations for TA-Lib, Pandas TA, and more.</p>
|
|
172
|
+
<h3>Rich indicator ecosystem</h3>
|
|
173
|
+
<p>Build custom indicators and use integrations for TA-Lib, Pandas TA, and more.</p>
|
|
174
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#rich-indicator-ecosystem">Indicator features →</a></p>
|
|
170
175
|
</td>
|
|
171
176
|
<td width="50%" valign="top">
|
|
172
|
-
<
|
|
173
|
-
Analyze trades, drawdowns, and performance, with QuantStats integration.</p>
|
|
177
|
+
<h3>Portfolio backtesting</h3>
|
|
178
|
+
<p>Analyze trades, drawdowns, and performance, with QuantStats integration.</p>
|
|
179
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#portfolio-backtesting">Portfolio analysis →</a></p>
|
|
174
180
|
</td>
|
|
175
181
|
</tr>
|
|
176
182
|
<tr>
|
|
177
183
|
<td width="50%" valign="top">
|
|
178
|
-
<
|
|
179
|
-
Generate, rank, map, and analyze the distribution of trading signals.</p>
|
|
184
|
+
<h3>Signal tooling</h3>
|
|
185
|
+
<p>Generate, rank, map, and analyze the distribution of trading signals.</p>
|
|
186
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#signal-tooling">Signal features →</a></p>
|
|
180
187
|
</td>
|
|
181
188
|
<td width="50%" valign="top">
|
|
182
|
-
<
|
|
183
|
-
Fetch market data, preprocess it, and generate synthetic time series.</p>
|
|
189
|
+
<h3>Built-in data access</h3>
|
|
190
|
+
<p>Fetch market data, preprocess it, and generate synthetic time series.</p>
|
|
191
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#built-in-data-access">Data features →</a></p>
|
|
184
192
|
</td>
|
|
185
193
|
</tr>
|
|
186
194
|
<tr>
|
|
187
195
|
<td width="50%" valign="top">
|
|
188
|
-
<
|
|
189
|
-
Run walk-forward optimization and generate labels for machine learning workflows.</p>
|
|
196
|
+
<h3>Robustness testing</h3>
|
|
197
|
+
<p>Run walk-forward optimization and generate labels for machine learning workflows.</p>
|
|
198
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#robustness-testing">Robustness testing →</a></p>
|
|
190
199
|
</td>
|
|
191
200
|
<td width="50%" valign="top">
|
|
192
|
-
<
|
|
193
|
-
Explore results with Plotly charts, Jupyter widgets, and browser dashboards.</p>
|
|
201
|
+
<h3>Interactive visualization</h3>
|
|
202
|
+
<p>Explore results with Plotly charts, Jupyter widgets, and browser dashboards.</p>
|
|
203
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#interactive-visualization">Plotting features →</a></p>
|
|
194
204
|
</td>
|
|
195
205
|
</tr>
|
|
196
206
|
<tr>
|
|
197
207
|
<td width="50%" valign="top">
|
|
198
|
-
<
|
|
199
|
-
Schedule data updates and send Telegram notifications.</p>
|
|
208
|
+
<h3>Automation tools</h3>
|
|
209
|
+
<p>Schedule data updates and send Telegram notifications.</p>
|
|
210
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#automation-tools">Scheduling and notifications →</a></p>
|
|
200
211
|
</td>
|
|
201
212
|
<td width="50%" valign="top">
|
|
202
|
-
<
|
|
203
|
-
Combine building blocks for rapid experimentation and AI agent-driven workflows.</p>
|
|
213
|
+
<h3>Composable Python API</h3>
|
|
214
|
+
<p>Combine building blocks for rapid experimentation and AI agent-driven workflows.</p>
|
|
215
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#composable-python-api">Python workflows →</a></p>
|
|
204
216
|
</td>
|
|
205
217
|
</tr>
|
|
206
218
|
</table>
|
|
@@ -243,7 +255,9 @@ pf = vbt.Portfolio.from_holding(price, init_cash=100)
|
|
|
243
255
|
print(pf.total_profit())
|
|
244
256
|
```
|
|
245
257
|
|
|
246
|
-
|
|
258
|
+
Output:
|
|
259
|
+
|
|
260
|
+
```text
|
|
247
261
|
19501.10906763755
|
|
248
262
|
```
|
|
249
263
|
|
|
@@ -259,7 +273,9 @@ pf = vbt.Portfolio.from_signals(price, entries, exits, init_cash=100)
|
|
|
259
273
|
print(pf.total_profit())
|
|
260
274
|
```
|
|
261
275
|
|
|
262
|
-
|
|
276
|
+
Output:
|
|
277
|
+
|
|
278
|
+
```text
|
|
263
279
|
34417.80960086067
|
|
264
280
|
```
|
|
265
281
|
|
|
@@ -287,7 +303,9 @@ fig = mean_expectancy.unstack().vbt.scatterplot(xaxis_title="randnx_n", yaxis_ti
|
|
|
287
303
|
fig.show()
|
|
288
304
|
```
|
|
289
305
|
|
|
290
|
-
|
|
306
|
+
Output:
|
|
307
|
+
|
|
308
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_rand_scatter.svg" alt="Random-strategy mean trade expectancy" />
|
|
291
309
|
|
|
292
310
|
### Test 10,000 dual-SMA window combinations
|
|
293
311
|
|
|
@@ -304,12 +322,18 @@ exits = fast_ma.ma_crossed_below(slow_ma)
|
|
|
304
322
|
pf = vbt.Portfolio.from_signals(price, entries, exits, size=np.inf, fees=0.001, freq="1D")
|
|
305
323
|
|
|
306
324
|
fig = pf.total_return().vbt.heatmap(
|
|
307
|
-
x_level="fast_window",
|
|
308
|
-
|
|
325
|
+
x_level="fast_window",
|
|
326
|
+
y_level="slow_window",
|
|
327
|
+
slider_level="symbol",
|
|
328
|
+
symmetric=True,
|
|
329
|
+
trace_kwargs=dict(colorbar=dict(title="Total return", tickformat="%")),
|
|
330
|
+
)
|
|
309
331
|
fig.show()
|
|
310
332
|
```
|
|
311
333
|
|
|
312
|
-
|
|
334
|
+
Output:
|
|
335
|
+
|
|
336
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_dmac_heatmap.gif" alt="Dual-SMA window combinations across assets" />
|
|
313
337
|
|
|
314
338
|
> [!TIP]
|
|
315
339
|
> **VectorBT PRO**
|
|
@@ -326,7 +350,9 @@ fig.show()
|
|
|
326
350
|
print(pf[(10, 20, "ETH-USD")].stats())
|
|
327
351
|
```
|
|
328
352
|
|
|
329
|
-
|
|
353
|
+
Output:
|
|
354
|
+
|
|
355
|
+
```text
|
|
330
356
|
Start 2017-11-09 00:00:00+00:00
|
|
331
357
|
End 2026-01-03 00:00:00+00:00
|
|
332
358
|
Period 2978 days 00:00:00
|
|
@@ -364,6 +390,8 @@ Name: (10, 20, ETH-USD), dtype: object
|
|
|
364
390
|
pf[(10, 20, "ETH-USD")].plot().show()
|
|
365
391
|
```
|
|
366
392
|
|
|
393
|
+
Output:
|
|
394
|
+
|
|
367
395
|
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/readme-portfolio.gif" alt="Inspecting trades, zooming, and toggling the portfolio benchmark" />
|
|
368
396
|
|
|
369
397
|
### Animate Bollinger Bands across multiple symbols
|
|
@@ -376,30 +404,44 @@ data = vbt.YFData.download(symbols, period="6mo", missing_index="drop")
|
|
|
376
404
|
price = data.get("Close")
|
|
377
405
|
bbands = vbt.BBANDS.run(price)
|
|
378
406
|
|
|
407
|
+
|
|
379
408
|
def plot(index, bbands):
|
|
380
409
|
bbands = bbands.loc[index]
|
|
381
410
|
fig = vbt.make_subplots(
|
|
382
|
-
rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.15,
|
|
383
|
-
|
|
411
|
+
rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.15, subplot_titles=("%B", "Bandwidth")
|
|
412
|
+
)
|
|
384
413
|
fig.update_layout(showlegend=False, width=750, height=400)
|
|
385
414
|
bbands.percent_b.vbt.ts_heatmap(
|
|
386
|
-
trace_kwargs=dict(
|
|
387
|
-
|
|
388
|
-
|
|
415
|
+
trace_kwargs=dict(
|
|
416
|
+
zmin=0,
|
|
417
|
+
zmid=0.5,
|
|
418
|
+
zmax=1,
|
|
419
|
+
colorscale="Spectral",
|
|
420
|
+
colorbar=dict(y=(fig.layout.yaxis.domain[0] + fig.layout.yaxis.domain[1]) / 2, len=0.5),
|
|
421
|
+
),
|
|
422
|
+
add_trace_kwargs=dict(row=1, col=1),
|
|
423
|
+
fig=fig,
|
|
424
|
+
)
|
|
389
425
|
bbands.bandwidth.vbt.ts_heatmap(
|
|
390
|
-
trace_kwargs=dict(colorbar=dict(
|
|
391
|
-
|
|
392
|
-
|
|
426
|
+
trace_kwargs=dict(colorbar=dict(y=(fig.layout.yaxis2.domain[0] + fig.layout.yaxis2.domain[1]) / 2, len=0.5)),
|
|
427
|
+
add_trace_kwargs=dict(row=2, col=1),
|
|
428
|
+
fig=fig,
|
|
429
|
+
)
|
|
393
430
|
return fig
|
|
394
431
|
|
|
395
|
-
|
|
432
|
+
|
|
433
|
+
vbt.save_animation(
|
|
434
|
+
"bbands.gif", bbands.wrapper.index, plot, bbands, delta=90, step=3, fps=3, writer_kwargs=dict(loop=0)
|
|
435
|
+
)
|
|
396
436
|
```
|
|
397
437
|
|
|
398
|
-
|
|
438
|
+
Output:
|
|
439
|
+
|
|
440
|
+
```text
|
|
399
441
|
100%|██████████| 31/31 [00:21<00:00, 1.21it/s]
|
|
400
442
|
```
|
|
401
443
|
|
|
402
|
-
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/
|
|
444
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_bbands.gif" alt="Rolling Bollinger Bands percent-B and bandwidth heatmaps" />
|
|
403
445
|
|
|
404
446
|
Visit the [website](https://vectorbt.dev/) for more examples, documentation, and guides.
|
|
405
447
|
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
<a href="#links">Links</a>
|
|
53
53
|
</p>
|
|
54
54
|
|
|
55
|
-
<
|
|
55
|
+
<h2 align="center">Trading research at scale.</h2>
|
|
56
56
|
|
|
57
|
-
<p align="center">VectorBT
|
|
57
|
+
<p align="center">VectorBT is a Python toolkit for trading research. Explore market data, build indicators and signals, and compare thousands of ideas across assets and timeframes. NumPy arrays, Numba acceleration, and an optional Rust engine let you run large experiments in a few lines of Python.</p>
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Move from exploring price patterns to evaluating strategies in one workflow. Inspect trades, fees, drawdowns, and portfolio performance, then explore the results with interactive charts. Built for traders, researchers, and AI agents, VectorBT brings data analysis, strategy simulation, and visualization together in a composable Python API.
|
|
62
62
|
|
|
63
63
|
VectorBT is the open-source community edition of [VectorBT PRO](https://vectorbt.pro/).
|
|
64
64
|
PRO extends the library with parallelization, additional data integrations, portfolio optimization,
|
|
@@ -73,62 +73,74 @@ See [VectorBT vs PRO](https://vectorbt.dev/getting-started/upgrade/) or browse
|
|
|
73
73
|
<table>
|
|
74
74
|
<tr>
|
|
75
75
|
<td width="50%" valign="top">
|
|
76
|
-
<
|
|
77
|
-
Research strategies at scale with pandas, NumPy, and Numba.</p>
|
|
76
|
+
<h3>Fast, vectorized backtesting</h3>
|
|
77
|
+
<p>Research strategies at scale with pandas, NumPy, and Numba.</p>
|
|
78
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#fast-vectorized-backtesting">Backtesting examples →</a></p>
|
|
78
79
|
</td>
|
|
79
80
|
<td width="50%" valign="top">
|
|
80
|
-
<
|
|
81
|
-
Use precompiled kernels for supported operations without JIT compilation.</p>
|
|
81
|
+
<h3>Optional Rust engine</h3>
|
|
82
|
+
<p>Use precompiled kernels for supported operations without JIT compilation.</p>
|
|
83
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#optional-rust-engine">Rust engine →</a></p>
|
|
82
84
|
</td>
|
|
83
85
|
</tr>
|
|
84
86
|
<tr>
|
|
85
87
|
<td width="50%" valign="top">
|
|
86
|
-
<
|
|
87
|
-
Work with custom accessors and high-performance operations directly on pandas objects.</p>
|
|
88
|
+
<h3>Pandas-native API</h3>
|
|
89
|
+
<p>Work with custom accessors and high-performance operations directly on pandas objects.</p>
|
|
90
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#pandas-native-api">Pandas integration →</a></p>
|
|
88
91
|
</td>
|
|
89
92
|
<td width="50%" valign="top">
|
|
90
|
-
<
|
|
91
|
-
Analyze multiple assets and sweep large parameter grids with flexible array broadcasting.</p>
|
|
93
|
+
<h3>Flexible broadcasting</h3>
|
|
94
|
+
<p>Analyze multiple assets and sweep large parameter grids with flexible array broadcasting.</p>
|
|
95
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#flexible-broadcasting">Broadcasting API →</a></p>
|
|
92
96
|
</td>
|
|
93
97
|
</tr>
|
|
94
98
|
<tr>
|
|
95
99
|
<td width="50%" valign="top">
|
|
96
|
-
<
|
|
97
|
-
Build custom indicators and use integrations for TA-Lib, Pandas TA, and more.</p>
|
|
100
|
+
<h3>Rich indicator ecosystem</h3>
|
|
101
|
+
<p>Build custom indicators and use integrations for TA-Lib, Pandas TA, and more.</p>
|
|
102
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#rich-indicator-ecosystem">Indicator features →</a></p>
|
|
98
103
|
</td>
|
|
99
104
|
<td width="50%" valign="top">
|
|
100
|
-
<
|
|
101
|
-
Analyze trades, drawdowns, and performance, with QuantStats integration.</p>
|
|
105
|
+
<h3>Portfolio backtesting</h3>
|
|
106
|
+
<p>Analyze trades, drawdowns, and performance, with QuantStats integration.</p>
|
|
107
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#portfolio-backtesting">Portfolio analysis →</a></p>
|
|
102
108
|
</td>
|
|
103
109
|
</tr>
|
|
104
110
|
<tr>
|
|
105
111
|
<td width="50%" valign="top">
|
|
106
|
-
<
|
|
107
|
-
Generate, rank, map, and analyze the distribution of trading signals.</p>
|
|
112
|
+
<h3>Signal tooling</h3>
|
|
113
|
+
<p>Generate, rank, map, and analyze the distribution of trading signals.</p>
|
|
114
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#signal-tooling">Signal features →</a></p>
|
|
108
115
|
</td>
|
|
109
116
|
<td width="50%" valign="top">
|
|
110
|
-
<
|
|
111
|
-
Fetch market data, preprocess it, and generate synthetic time series.</p>
|
|
117
|
+
<h3>Built-in data access</h3>
|
|
118
|
+
<p>Fetch market data, preprocess it, and generate synthetic time series.</p>
|
|
119
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#built-in-data-access">Data features →</a></p>
|
|
112
120
|
</td>
|
|
113
121
|
</tr>
|
|
114
122
|
<tr>
|
|
115
123
|
<td width="50%" valign="top">
|
|
116
|
-
<
|
|
117
|
-
Run walk-forward optimization and generate labels for machine learning workflows.</p>
|
|
124
|
+
<h3>Robustness testing</h3>
|
|
125
|
+
<p>Run walk-forward optimization and generate labels for machine learning workflows.</p>
|
|
126
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#robustness-testing">Robustness testing →</a></p>
|
|
118
127
|
</td>
|
|
119
128
|
<td width="50%" valign="top">
|
|
120
|
-
<
|
|
121
|
-
Explore results with Plotly charts, Jupyter widgets, and browser dashboards.</p>
|
|
129
|
+
<h3>Interactive visualization</h3>
|
|
130
|
+
<p>Explore results with Plotly charts, Jupyter widgets, and browser dashboards.</p>
|
|
131
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#interactive-visualization">Plotting features →</a></p>
|
|
122
132
|
</td>
|
|
123
133
|
</tr>
|
|
124
134
|
<tr>
|
|
125
135
|
<td width="50%" valign="top">
|
|
126
|
-
<
|
|
127
|
-
Schedule data updates and send Telegram notifications.</p>
|
|
136
|
+
<h3>Automation tools</h3>
|
|
137
|
+
<p>Schedule data updates and send Telegram notifications.</p>
|
|
138
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#automation-tools">Scheduling and notifications →</a></p>
|
|
128
139
|
</td>
|
|
129
140
|
<td width="50%" valign="top">
|
|
130
|
-
<
|
|
131
|
-
Combine building blocks for rapid experimentation and AI agent-driven workflows.</p>
|
|
141
|
+
<h3>Composable Python API</h3>
|
|
142
|
+
<p>Combine building blocks for rapid experimentation and AI agent-driven workflows.</p>
|
|
143
|
+
<p><a href="https://vectorbt.dev/getting-started/features/#composable-python-api">Python workflows →</a></p>
|
|
132
144
|
</td>
|
|
133
145
|
</tr>
|
|
134
146
|
</table>
|
|
@@ -171,7 +183,9 @@ pf = vbt.Portfolio.from_holding(price, init_cash=100)
|
|
|
171
183
|
print(pf.total_profit())
|
|
172
184
|
```
|
|
173
185
|
|
|
174
|
-
|
|
186
|
+
Output:
|
|
187
|
+
|
|
188
|
+
```text
|
|
175
189
|
19501.10906763755
|
|
176
190
|
```
|
|
177
191
|
|
|
@@ -187,7 +201,9 @@ pf = vbt.Portfolio.from_signals(price, entries, exits, init_cash=100)
|
|
|
187
201
|
print(pf.total_profit())
|
|
188
202
|
```
|
|
189
203
|
|
|
190
|
-
|
|
204
|
+
Output:
|
|
205
|
+
|
|
206
|
+
```text
|
|
191
207
|
34417.80960086067
|
|
192
208
|
```
|
|
193
209
|
|
|
@@ -215,7 +231,9 @@ fig = mean_expectancy.unstack().vbt.scatterplot(xaxis_title="randnx_n", yaxis_ti
|
|
|
215
231
|
fig.show()
|
|
216
232
|
```
|
|
217
233
|
|
|
218
|
-
|
|
234
|
+
Output:
|
|
235
|
+
|
|
236
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_rand_scatter.svg" alt="Random-strategy mean trade expectancy" />
|
|
219
237
|
|
|
220
238
|
### Test 10,000 dual-SMA window combinations
|
|
221
239
|
|
|
@@ -232,12 +250,18 @@ exits = fast_ma.ma_crossed_below(slow_ma)
|
|
|
232
250
|
pf = vbt.Portfolio.from_signals(price, entries, exits, size=np.inf, fees=0.001, freq="1D")
|
|
233
251
|
|
|
234
252
|
fig = pf.total_return().vbt.heatmap(
|
|
235
|
-
x_level="fast_window",
|
|
236
|
-
|
|
253
|
+
x_level="fast_window",
|
|
254
|
+
y_level="slow_window",
|
|
255
|
+
slider_level="symbol",
|
|
256
|
+
symmetric=True,
|
|
257
|
+
trace_kwargs=dict(colorbar=dict(title="Total return", tickformat="%")),
|
|
258
|
+
)
|
|
237
259
|
fig.show()
|
|
238
260
|
```
|
|
239
261
|
|
|
240
|
-
|
|
262
|
+
Output:
|
|
263
|
+
|
|
264
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_dmac_heatmap.gif" alt="Dual-SMA window combinations across assets" />
|
|
241
265
|
|
|
242
266
|
> [!TIP]
|
|
243
267
|
> **VectorBT PRO**
|
|
@@ -254,7 +278,9 @@ fig.show()
|
|
|
254
278
|
print(pf[(10, 20, "ETH-USD")].stats())
|
|
255
279
|
```
|
|
256
280
|
|
|
257
|
-
|
|
281
|
+
Output:
|
|
282
|
+
|
|
283
|
+
```text
|
|
258
284
|
Start 2017-11-09 00:00:00+00:00
|
|
259
285
|
End 2026-01-03 00:00:00+00:00
|
|
260
286
|
Period 2978 days 00:00:00
|
|
@@ -292,6 +318,8 @@ Name: (10, 20, ETH-USD), dtype: object
|
|
|
292
318
|
pf[(10, 20, "ETH-USD")].plot().show()
|
|
293
319
|
```
|
|
294
320
|
|
|
321
|
+
Output:
|
|
322
|
+
|
|
295
323
|
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/readme-portfolio.gif" alt="Inspecting trades, zooming, and toggling the portfolio benchmark" />
|
|
296
324
|
|
|
297
325
|
### Animate Bollinger Bands across multiple symbols
|
|
@@ -304,30 +332,44 @@ data = vbt.YFData.download(symbols, period="6mo", missing_index="drop")
|
|
|
304
332
|
price = data.get("Close")
|
|
305
333
|
bbands = vbt.BBANDS.run(price)
|
|
306
334
|
|
|
335
|
+
|
|
307
336
|
def plot(index, bbands):
|
|
308
337
|
bbands = bbands.loc[index]
|
|
309
338
|
fig = vbt.make_subplots(
|
|
310
|
-
rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.15,
|
|
311
|
-
|
|
339
|
+
rows=2, cols=1, shared_xaxes=True, vertical_spacing=0.15, subplot_titles=("%B", "Bandwidth")
|
|
340
|
+
)
|
|
312
341
|
fig.update_layout(showlegend=False, width=750, height=400)
|
|
313
342
|
bbands.percent_b.vbt.ts_heatmap(
|
|
314
|
-
trace_kwargs=dict(
|
|
315
|
-
|
|
316
|
-
|
|
343
|
+
trace_kwargs=dict(
|
|
344
|
+
zmin=0,
|
|
345
|
+
zmid=0.5,
|
|
346
|
+
zmax=1,
|
|
347
|
+
colorscale="Spectral",
|
|
348
|
+
colorbar=dict(y=(fig.layout.yaxis.domain[0] + fig.layout.yaxis.domain[1]) / 2, len=0.5),
|
|
349
|
+
),
|
|
350
|
+
add_trace_kwargs=dict(row=1, col=1),
|
|
351
|
+
fig=fig,
|
|
352
|
+
)
|
|
317
353
|
bbands.bandwidth.vbt.ts_heatmap(
|
|
318
|
-
trace_kwargs=dict(colorbar=dict(
|
|
319
|
-
|
|
320
|
-
|
|
354
|
+
trace_kwargs=dict(colorbar=dict(y=(fig.layout.yaxis2.domain[0] + fig.layout.yaxis2.domain[1]) / 2, len=0.5)),
|
|
355
|
+
add_trace_kwargs=dict(row=2, col=1),
|
|
356
|
+
fig=fig,
|
|
357
|
+
)
|
|
321
358
|
return fig
|
|
322
359
|
|
|
323
|
-
|
|
360
|
+
|
|
361
|
+
vbt.save_animation(
|
|
362
|
+
"bbands.gif", bbands.wrapper.index, plot, bbands, delta=90, step=3, fps=3, writer_kwargs=dict(loop=0)
|
|
363
|
+
)
|
|
324
364
|
```
|
|
325
365
|
|
|
326
|
-
|
|
366
|
+
Output:
|
|
367
|
+
|
|
368
|
+
```text
|
|
327
369
|
100%|██████████| 31/31 [00:21<00:00, 1.21it/s]
|
|
328
370
|
```
|
|
329
371
|
|
|
330
|
-
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/
|
|
372
|
+
<img width="750" src="https://raw.githubusercontent.com/polakowo/vectorbt/master/docs/docs/assets/images/usage_bbands.gif" alt="Rolling Bollinger Bands percent-B and bandwidth heatmaps" />
|
|
331
373
|
|
|
332
374
|
Visit the [website](https://vectorbt.dev/) for more examples, documentation, and guides.
|
|
333
375
|
|
|
File without changes
|