Position
QuantConnect.Securities.Positions.Position
Position(
symbol: Union[Symbol, str, BaseContract],
quantity: float,
unit_quantity: float,
)
Position(
security: Security, quantity: Optional[float] = None
)
Bases: Object, IPosition
Defines a quantity of a security's holdings for inclusion in a position group
Signature descriptions:
-
Initializes a new instance of the Position class
-
Initializes a new instance of the Position class using the security's lot size as it's unit quantity. If quantity is null, then the security's holdings quantity is used.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbol
|
Optional[Union[Symbol, str, BaseContract]]
|
The symbol |
None
|
quantity
|
float | Optional[float]
|
The quantity |
None
|
unit_quantity
|
Optional[float]
|
The position's unit quantity within its group |
None
|
security
|
Optional[Security]
|
The security |
None
|
quantity
quantity: float
The quantity
unit_quantity
unit_quantity: float
The unit quantity. The unit quantities of a group define the group. For example, a covered call has 100 units of stock and -1 units of call contracts.
to_string
to_string() -> str
Returns a string that represents the current object.
Returns:
| Type | Description |
|---|---|
str
|
A string that represents the current object. |