Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Order price can now be 0 to accommodate unusual scenarios #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions vectorbt/portfolio/nb.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ def execute_order_nb(state: ProcessOrderState, order: Order) -> tp.Tuple[Execute
raise ValueError("position is negative but order.direction is Direction.LongOnly")
if order.direction == Direction.ShortOnly and position > 0:
raise ValueError("position is positive but order.direction is Direction.ShortOnly")
if not np.isfinite(order.price) or order.price <= 0:
raise ValueError("order.price must be finite and greater than 0")
if not np.isfinite(order.price) or order.price < 0:
raise ValueError("order.price must be finite and greater than or equal to 0")
if not np.isfinite(order.fees) or order.fees < 0:
raise ValueError("order.fees must be finite and 0 or greater")
if not np.isfinite(order.fixed_fees) or order.fixed_fees < 0:
Expand Down