Skip to content

IPositionGroup

QuantConnect.Securities.Positions.IPositionGroup

Bases: Sequence[IPosition]

Defines a group of positions allowing for more efficient use of portfolio margin

key

Gets the key identifying this group

quantity

quantity: float

Gets the whole number of units in this position group

positions

positions: Iterable[IPosition]

Gets the positions in this group

buying_power_model

buying_power_model: IPositionGroupBuyingPowerModel

Gets the buying power model defining how margin works in this group

try_get_position

try_get_position(
    symbol: Union[Symbol, str, BaseContract],
    position: Optional[IPosition],
) -> Tuple[bool, IPosition]

Attempts to retrieve the position with the specified symbol

Parameters:

Name Type Description Default
symbol Union[Symbol, str, BaseContract]

The symbol

required
position Optional[IPosition]

The position, if found

required

Returns:

Type Description
Tuple[bool, IPosition]

True if the position was found, otherwise false.