self.get_selling_order#

lumibot.strategies.strategy.Strategy.get_selling_order(self, position)#

Get the selling order for a position.

Parameters:

position (Position) – The position to get the selling order for.

Return type:

Order or None

Example

>>> # Get the selling order for a position
>>> position = self.get_position("SPY")
>>> order = self.get_selling_order(position)
>>> self.submit_order(order)
>>> # Sell all positions owned by the account
>>> for position in self.get_positions():
>>>    order = self.get_selling_order(position)
>>>    self.submit_order(order)