Exemple #1
0
 def place_back_order(self, order: Order) -> None:
     if order in self.placed:
         self.placed.remove(order)
         self.monitor.append(order)
         order.set_status(OrderStatus.MONITOR)
     else:
         log.critical(
             f'trying to place back to monitor an order not found in the placed list: {order}'
         )
Exemple #2
0
 def place_order(self, order: Order) -> None:
     if order in self.monitor:
         self.monitor.remove(order)
         self.placed.append(order)
         # in session, once placement confirmed, will be set to status PLACED
         order.set_status(OrderStatus.TO_BE_PLACED)
     else:
         log.critical(
             f'trying to place an order not found in the monitor list: {order}'
         )
Exemple #3
0
 def _process_place_order(self, order: Order) -> bool:
     new_placement_allowed = True
     self.pob.place_order(order=order)
     is_order_placed, new_status = self._place_order(order=order)
     if is_order_placed:
         # 2. placed: (s: PLACED, t: pending_orders, l: placed)
         order.set_status(status=OrderStatus.PLACED)
         # to control one new placement per cycle mode
         if K_ONE_PLACE_PER_CYCLE_MODE:
             new_placement_allowed = False
     else:
         self.pob.place_back_order(order=order)
         log.critical(f'for unknown reason the order has not been placed: {order}')
     return new_placement_allowed