def on_partially_filled_order

The lifecycle method called when an order has been partially filled by the broker. Use this lifecycle event to execute code when an order has been partially filled by the broker.

Parameters:

order (Order): The order object that is being processed by the broker price (float): The filled price quantity (int): The filled quantity multiplier (int): Options multiplier

class MyStrategy(Strategy):
    def on_partially_filled_order(self, order, price, quantity, multiplier):
        missing = order.quantity - quantity
        self.log_message(f"{quantity} has been filled")
        self.log_message(f"{quantity} waiting for the remaining {missing}")

Reference

lumibot.strategies.strategy.Strategy.on_partially_filled_order(self, position, order, price, quantity, multiplier)

Use this lifecycle event to execute code when an order has been partially filled by the broker

Parameters:
  • position (Position object) – The position that is being filled.

  • order (Order object) – The order that is being filled.

  • price (float) – The price of the fill.

  • quantity (int) – The quantity of the fill.

  • multiplier (float) – The multiplier of the fill.

Return type:

None

Example

>>> def on_partially_filled_order(self, position, order, price, quantity, multiplier):
>>>     if order.asset == "AAPL":
>>>         self.log_message(f"{quantity} shares of AAPL partially filled")
>>>         self.log_message(f"Price: {price}")