Skip to content

Commit

Permalink
Rename indicators to generators
Browse files Browse the repository at this point in the history
  • Loading branch information
polakowo committed Feb 21, 2021
1 parent 6f1b451 commit 4152f22
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 24 deletions.
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
![Logo](https://raw.githubusercontent.com/polakowo/vectorbt/master/static/favicon/favicon-128x128.png)

vectorbt is a backtesting library on steroids - it operates entirely on pandas and NumPy objects, and is
accelerated by [Numba](https://github.com/numba/numba) to analyze trading strategies at speed and scale :fire:
accelerated by [Numba](https://github.com/numba/numba) to analyze time series at speed and scale :fire:

In contrast to conventional libraries, vectorbt represents trading data as nd-arrays.
In contrast to conventional libraries, vectorbt represents any data as nd-arrays.
This enables superfast computation using vectorized operations with NumPy and non-vectorized but compiled
operations with Numba. It also integrates [plotly.py](https://github.com/plotly/plotly.py) and
[ipywidgets](https://github.com/jupyter-widgets/ipywidgets) to display complex charts and dashboards akin
Expand All @@ -26,7 +26,7 @@ data-hungry widgets without significant delays.
With vectorbt you can
* Analyze time series and engineer features
* Supercharge pandas and your favorite tools to run much faster
* Test many strategies, configurations, assets, and time ranges in one go
* Test many trading strategies, configurations, assets, and time ranges in one go
* Test machine learning models
* Build interactive charts/dashboards without leaving Jupyter

Expand Down Expand Up @@ -270,7 +270,7 @@ method is flexible towards inputs and can work on both Series and DataFrames.
3.32 ms ± 19.7 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```

- Helper functions for combining, transforming, and indexing NumPy and pandas objects
- Functions for combining, transforming, and indexing NumPy and pandas objects
- NumPy-like broadcasting for pandas, among other features

```python-repl
Expand Down Expand Up @@ -322,7 +322,7 @@ dtype: bool
```

- Signal factory for building iterative signal generators
- Also includes a range of basic generators such for random signals
- Also includes a range of basic generators such as random signal generator

```python-repl
>>> rand = vbt.RAND.run(n=[0, 1, 2], input_shape=(6,), seed=42)
Expand Down Expand Up @@ -367,8 +367,9 @@ rand_n 0 1 2
```

![trades.png](https://raw.githubusercontent.com/polakowo/vectorbt/master/static/trades.png)

- A range of basic technical indicators with full Numba support

- Indicator factory for building complex technical indicators with ease
- Technical indicators with full Numba support
- Moving average, Bollinger Bands, RSI, Stochastic, MACD, and more
- Each offers methods for generating signals and plotting
- Each allows arbitrary parameter combinations, from arrays to Cartesian products
Expand All @@ -382,9 +383,8 @@ ma_ewm False True
2 2.5 2.428571
```

- Indicator factory for building complex technical indicators with ease
- Supports [TA-Lib](https://github.com/mrjbq7/ta-lib) indicators out of the box

- Support for [TA-Lib](https://github.com/mrjbq7/ta-lib) indicators out of the box

```python-repl
>>> SMA = vbt.IndicatorFactory.from_talib('SMA')
>>> SMA.run([1., 2., 3.], timeperiod=[2, 3]).real
Expand All @@ -393,9 +393,18 @@ sma_timeperiod 2 3
1 1.5 NaN
2 2.5 2.0
```

- Interactive Plotly-based widgets to visualize backtest results
- Support of ipywidgets for displaying interactive dashboards in Jupyter

- Look-ahead indicators and label generators
- Search for local extrema, breakout detection, and more

```python-repl
>>> price = np.cumprod(np.random.uniform(-0.1, 0.1, size=100) + 1)
>>> vbt.LEXLB.run(price, 0.2, 0.2).plot().show()
```

![local_extrema.png](https://raw.githubusercontent.com/polakowo/vectorbt/master/static/local_extrema.png)

- Interactive Plotly-based widgets for visual data analysis

## Resources

Expand Down
Binary file added static/local_extrema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
neg_ths = [np.array([1 / 2, 1 / 3]), np.array([1 / 2, 2 / 3]), np.array([1 / 2, 3 / 4])]


# ############# basic.py ############# #
# ############# generators.py ############# #

class TestBasic:
def test_FMEAN(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ def choice_nb(from_i, to_i, col, ts, in_out, n, arg, temp_idx_arr, kw):
)


# ############# basic.py ############# #
# ############# generators.py ############# #

class TestBasic:
def test_RAND(self):
Expand Down
6 changes: 3 additions & 3 deletions vectorbt/labels/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Modules for building and running look-ahead indicators and label generators.
## Basic
## Generators
Module `vectorbt.labels.basic` provides a collection of basic look-ahead indicators and label generators.
Module `vectorbt.labels.generators` provides a collection of look-ahead indicators and label generators.
You can access all the indicators either by `vbt.*` or `vbt.labels.*`.
Expand All @@ -17,7 +17,7 @@
"""

from vectorbt.labels.enums import *
from vectorbt.labels.basic import (
from vectorbt.labels.generators import (
FMEAN,
FSTD,
FMIN,
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions vectorbt/portfolio/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
from vectorbt.base.array_wrapper import ArrayWrapper, Wrapping
from vectorbt.generic import nb as generic_nb
from vectorbt.generic.drawdowns import Drawdowns
from vectorbt.signals.basic import RAND, RPROB
from vectorbt.signals.generators import RAND, RPROB
from vectorbt.portfolio import nb
from vectorbt.portfolio.orders import Orders
from vectorbt.portfolio.trades import Trades, Positions
Expand Down Expand Up @@ -485,8 +485,8 @@ def from_random(cls, close, n=None, prob=None, entry_prob=None, exit_prob=None,
Generates signals based either on the number of signals `n` or the probability
of encountering a signal `prob`.
If `n` is set, see `vectorbt.signals.basic.RAND`.
If `prob` is set, see `vectorbt.signals.basic.RPROB`.
If `n` is set, see `vectorbt.signals.generators.RAND`.
If `prob` is set, see `vectorbt.signals.generators.RPROB`.
Based on `Portfolio.from_signals`."""
from vectorbt import settings
Expand Down
6 changes: 3 additions & 3 deletions vectorbt/signals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
of your inputs, parameters, and outputs, it will create a stand-alone class capable of generating
signals for an arbitrary combination of your inputs and parameters.
## Basic
## Generators
`vectorbt.signals.basic` provides a collection of basic signal generators, such as
`vectorbt.signals.generators` provides a collection of signal generators, such as
random signal generator, all built with `vectorbt.signals.factory.SignalFactory`.
## Numba-compiled functions
Expand All @@ -56,7 +56,7 @@

from vectorbt.signals.enums import *
from vectorbt.signals.factory import SignalFactory
from vectorbt.signals.basic import (
from vectorbt.signals.generators import (
RAND,
RPROB,
RPROBEX,
Expand Down
File renamed without changes.

0 comments on commit 4152f22

Please sign in to comment.