Skip to content

Commit

Permalink
Fix value size type in from_signals
Browse files Browse the repository at this point in the history
  • Loading branch information
polakowo committed Jan 8, 2022
1 parent 89af7b1 commit a97b586
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 20 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ data even without GPU and parallelization and enables the user to interact with
without significant delays.

With vectorbt, you can
* Backtest strategies in **a couple of lines** of Python code
* Enjoy the best of both worlds: the ecosystem of Python and **the speed of C**
* Retain **full control** over execution (as opposed to web-based services such as TradingView)
* Optimize your trading strategy against many parameters, assets, and periods **in one go**
* Uncover **hidden patterns** in financial markets
* Analyze time series and engineer new features for **ML models**
* Backtest strategies in a couple of lines of Python code
* Enjoy the best of both worlds: the ecosystem of Python and the speed of C
* Retain full control over execution (as opposed to web-based services such as TradingView)
* Optimize your trading strategy against many parameters, assets, and periods in one go
* Uncover hidden patterns in financial markets
* Analyze time series and engineer new features for ML models
* Supercharge pandas and your favorite tools to run much faster
* Visualize strategy performance using **interactive charts and dashboards** (both in Jupyter and browser)
* Visualize strategy performance using interactive charts and dashboards (both in Jupyter and browser)
* Fetch and process data periodically, send Telegram notifications, and more :fire:

## Installation
Expand Down
5 changes: 3 additions & 2 deletions docs/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ pip install -e vectorbt

## Troubleshooting

* [TA-Lib support](https://github.com/mrjbq7/ta-lib#dependencies)
* [Jupyter Notebook and JupyterLab support](https://plotly.com/python/getting-started/#jupyter-notebook-support)
* [TA-Lib](https://github.com/mrjbq7/ta-lib#dependencies)
* [Jupyter Notebook and JupyterLab](https://plotly.com/python/getting-started/#jupyter-notebook-support)
* [Apple M1](https://github.com/polakowo/vectorbt/issues/320)
14 changes: 7 additions & 7 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ without significant delays.

With vectorbt, you can

- [x] Backtest strategies in **a couple of lines** of Python code
- [x] Enjoy the best of both worlds: the ecosystem of Python and **the speed of C**
- [x] Retain **full control** over execution and your data (as opposed to web-based services such as TradingView)
- [x] Optimize your trading strategy against many parameters, assets, and periods **in one go**
- [x] Uncover **hidden patterns** in financial markets
- [x] Analyze time series and engineer new features for **ML models**
- [x] Backtest strategies in a couple of lines of Python code
- [x] Enjoy the best of both worlds: the ecosystem of Python and the speed of C
- [x] Retain full control over execution and your data (as opposed to web-based services such as TradingView)
- [x] Optimize your trading strategy against many parameters, assets, and periods in one go
- [x] Uncover hidden patterns in financial markets
- [x] Analyze time series and engineer new features for ML models
- [x] Supercharge pandas and your favorite tools to run much faster
- [x] Visualize strategy performance using **interactive charts and dashboards** (both in Jupyter and browser)
- [x] Visualize strategy performance using interactive charts and dashboards (both in Jupyter and browser)
- [x] Fetch and process data periodically, send Telegram notifications, and more :fire:

## Why vectorbt?
Expand Down
5 changes: 2 additions & 3 deletions tests/test_portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1878,9 +1878,8 @@ def test_value(self):
record_arrays_close(
from_signals_both(size=[[0, 1, np.inf]], size_type='value').order_records,
np.array([
(0, 1, 0, 1.0, 1.0, 0.0, 0), (1, 1, 3, 0.3125, 4.0, 0.0, 1),
(2, 1, 4, 0.1775, 5.0, 0.0, 1), (3, 2, 0, 100.0, 1.0, 0.0, 0),
(4, 2, 3, 200.0, 4.0, 0.0, 1)
(0, 1, 0, 1.0, 1.0, 0.0, 0), (1, 1, 3, 1.25, 4.0, 0.0, 1),
(2, 2, 0, 100.0, 1.0, 0.0, 0), (3, 2, 3, 200.0, 4.0, 0.0, 1)
], dtype=order_dt)
)
record_arrays_close(
Expand Down
2 changes: 1 addition & 1 deletion vectorbt/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021 Oleg Polakow. All rights reserved.
# This code is licensed under Apache 2.0 with Commons Clause license (see LICENSE.md for details)

__version__ = "0.23.1"
__version__ = "0.23.2"
2 changes: 2 additions & 0 deletions vectorbt/portfolio/nb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,7 @@ def signals_to_size_nb(position_now: float,
order_size -= size / val_price_now
else:
order_size -= size
size_type = SizeType.Amount
elif is_long_exit:
direction = Direction.LongOnly
if accumulate == AccumulationMode.Both or accumulate == AccumulationMode.RemoveOnly:
Expand Down Expand Up @@ -1755,6 +1756,7 @@ def signals_to_size_nb(position_now: float,
order_size += size / val_price_now
else:
order_size += size
size_type = SizeType.Amount
elif is_short_exit:
direction = Direction.ShortOnly
if accumulate == AccumulationMode.Both or accumulate == AccumulationMode.RemoveOnly:
Expand Down

0 comments on commit a97b586

Please sign in to comment.