PositionExtensions
QuantConnect.Securities.Positions.PositionExtensions
Bases: Object
Provides extension methods for IPosition
combine
Combines the provided positions into a single position with the quantities added and the minimum unit quantity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IPosition
|
The position |
required |
other
|
IPosition
|
The other position to add |
required |
Returns:
| Type | Description |
|---|---|
IPosition
|
The combined position. |
consolidate
deduct
Deducts the specified quantity_to_deduct from the specified position
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IPosition
|
The source position |
required |
quantity_to_deduct
|
float
|
The quantity to deduct |
required |
Returns:
| Type | Description |
|---|---|
IPosition
|
A new position with the same properties but quantity reduced by the specified amount. |
get_group_quantity
get_group_quantity(position: IPosition) -> float
Gets the quantity a group would have if the given position were part of it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IPosition
|
The position |
required |
Returns:
| Type | Description |
|---|---|
float
|
The group quantity. |
with_lots
Creates a new IPosition with quantity equal to number_of_lots times its unit quantity
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position
|
IPosition
|
The position |
required |
number_of_lots
|
float
|
The number of lots for the new position |
required |
Returns:
| Type | Description |
|---|---|
IPosition
|
A new position with the specified number of lots. |