Skip to content

Commit

Permalink
fix for order circle color
Browse files Browse the repository at this point in the history
  • Loading branch information
Al4ise committed Nov 27, 2024
1 parent 650ad42 commit e8ec025
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions lumibot/brokers/interactive_brokers_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ def submit_orders(
order.order_class = Order.OrderClass.MULTILEG
order.identifier = response[0]["order_id"]
order.status=Order.OrderStatus.SUBMITTED
order.side = order_data['orders'][0]['side'].lower() if order_data is not None else None

order.child_orders = orders
for n, child_order in enumerate(order.child_orders):
Expand Down
20 changes: 12 additions & 8 deletions lumibot/entities/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,20 @@ def __init__(
)

def is_buy_order(self):
return self.side == self.OrderSide.BUY or \
self.side == self.OrderSide.BUY_TO_OPEN or \
self.side == self.OrderSide.BUY_TO_COVER or \
self.side == self.OrderSide.BUY_TO_CLOSE
return self.side is not None and (
self.side.lower() == self.OrderSide.BUY or
self.side.lower() == self.OrderSide.BUY_TO_OPEN or
self.side.lower() == self.OrderSide.BUY_TO_COVER or
self.side.lower() == self.OrderSide.BUY_TO_CLOSE
)

def is_sell_order(self):
return self.side == self.OrderSide.SELL or \
self.side == self.OrderSide.SELL_SHORT or \
self.side == self.OrderSide.SELL_TO_OPEN or \
self.side == self.OrderSide.SELL_TO_CLOSE
return self.side is not None and (
self.side.lower() == self.OrderSide.SELL or
self.side.lower() == self.OrderSide.SELL_SHORT or
self.side.lower() == self.OrderSide.SELL_TO_OPEN or
self.side.lower() == self.OrderSide.SELL_TO_CLOSE
)

def is_parent(self) -> bool:
"""
Expand Down

0 comments on commit e8ec025

Please sign in to comment.