Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# self.get_positions

strategies.strategy.Strategy.get_positions(self)

  Get all positions for the account.

  Parameters:

    None –

  Returns:

    A list of Position objects for the strategy if there are tracked positions or returns and empty list to indicate no tracked position.

  Return type:

    list

  Example

      >>> # Get all tracked positions
      >>> positions = self.get_positions()
      >>> for position in positions:
      >>>     # Show the quantity of each position
      >>>     self.log_message(position.quantity)
      >>>     # Show the asset of each position
      >>>     self.log_message(position.asset)