-
Notifications
You must be signed in to change notification settings - Fork 162
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
multileg notifications bug fix #442
Conversation
My review is in progress 📖 - I will have feedback for you in a few minutes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed your code and found 6 potential issues. To discuss my individual comments that I have added, tag me in replies using @korbit-ai.
Please react with a 👍 to my comments that you find helpful and a 👎 to those you find unhelpful - this will help me learn and improve as we collaborate.
# Create the order object | ||
order = self._parse_broker_order(leg, strategy_name, strategy_object) | ||
|
||
# TODO: Get the average fill price and quantity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
match order.status.lower(): | ||
case "submitted" | "open": | ||
self.stream.dispatch(self.NEW_ORDER, order=stored_order) | ||
case "partial_filled": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | ||
Submit multiple orders to the broker. This function will submit the orders in the order they are provided. | ||
If any order fails to submit, the function will stop submitting orders and return the last successful order. | ||
""" | ||
# Check if the orders are empty | ||
if not orders: | ||
if not orders or len(orders) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return | ||
|
||
# Check if it is a multi-leg order | ||
if is_multileg: | ||
tag = orders[0].tag if orders[0].tag else orders[0].strategy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -282,7 +285,7 @@ def __init__( | |||
self.custom_params = custom_params | |||
self._trail_stop_price = None | |||
self.tag = tag | |||
self.avg_fill_price = 0.0 # The weighted average filled price for this order. Calculated if not given by broker | |||
self.avg_fill_price = avg_fill_price # The weighted average filled price for this order. Calculated if not given by broker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -92,6 +92,7 @@ def __init__( | |||
trade_cost: float = None, | |||
custom_params={}, | |||
identifier=None, | |||
avg_fill_price=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…h/lumibot into multileg-notifications
No description provided.