PositionGroupKey
QuantConnect.Securities.Positions.PositionGroupKey
PositionGroupKey(
buying_power_model: IPositionGroupBuyingPowerModel,
security: Security,
)
PositionGroupKey(
buying_power_model: IPositionGroupBuyingPowerModel,
positions: Sequence[IPosition],
)
Bases: Object, IEquatable[QuantConnect_Securities_Positions_PositionGroupKey]
Defines a unique and deterministic key for IPositionGroup
Signature descriptions:
-
Initializes a new instance of the PositionGroupKey class for groups with a single security
-
Initializes a new instance of the PositionGroupKey class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buying_power_model
|
IPositionGroupBuyingPowerModel
|
The group's buying power model |
required |
security
|
Optional[Security]
|
The security |
None
|
positions
|
Optional[Sequence[IPosition]]
|
The positions comprising the group |
None
|
is_default_group
is_default_group: bool
Gets whether or not this key defines a default group
buying_power_model
buying_power_model: IPositionGroupBuyingPowerModel
Gets the IPositionGroupBuyingPowerModel being used by the group
unit_quantities
unit_quantities: Sequence[Tuple[Symbol, float]]
Gets the unit quantities defining the ratio between position quantities in the group
equals
equals(obj: Any) -> bool
equals(other: PositionGroupKey) -> bool
Signature descriptions:
-
Determines whether the specified object is equal to the current object.
-
Indicates whether the current object is equal to another object of the same type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
Optional[Any]
|
The object to compare with the current object. |
None
|
other
|
Optional[PositionGroupKey]
|
An object to compare with this object. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
Depends on the signature used. Case 1: [true if the specified object is equal to the current object; otherwise, false.]; Case 2: [true if the current object is equal to the other parameter; otherwise, false.] |
create_empty_positions
create_empty_positions() -> List[IPosition]
Creates a new array of empty positions with unit quantities according to this key
get_hash_code
get_hash_code() -> int
Serves as the default hash function.
Returns:
| Type | Description |
|---|---|
int
|
A hash code for the current object. |
to_string
to_string() -> str
Returns a string that represents the current object.
Returns:
| Type | Description |
|---|---|
str
|
A string that represents the current object. |