Lean  $LEAN_TAG$
QuantConnect.Securities.Positions.PositionGroup Class Reference

Provides a default implementation of IPositionGroup More...

Inheritance diagram for QuantConnect.Securities.Positions.PositionGroup:
[legend]

Public Member Functions

 PositionGroup (IPositionGroupBuyingPowerModel buyingPowerModel, decimal quantity, params IPosition[] positions)
 Initializes a new instance of the PositionGroup class More...
 
 PositionGroup (PositionGroupKey key, decimal quantity, params IPosition[] positions)
 Initializes a new instance of the PositionGroup class More...
 
 PositionGroup (PositionGroupKey key, decimal quantity, Dictionary< Symbol, IPosition > positions)
 Initializes a new instance of the PositionGroup class More...
 
bool TryGetPosition (Symbol symbol, out IPosition position)
 Attempts to retrieve the position with the specified symbol More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 
IEnumerator< IPositionGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Static Public Member Functions

static PositionGroup Empty (IPositionGroupBuyingPowerModel buyingPowerModel)
 Instantiates a default empty position group instance More...
 

Public Attributes

int Count => _positions.Count
 Gets the number of positions in the group More...
 
IEnumerable< IPositionPositions => _positions.Values
 Gets the positions in this group More...
 
IPositionGroupBuyingPowerModel BuyingPowerModel => Key.BuyingPowerModel
 Gets the buying power model defining how margin works in this group More...
 

Properties

PositionGroupKey Key [get]
 Gets the key identifying this group More...
 
decimal Quantity [get]
 Gets the whole number of units in this position group More...
 
- Properties inherited from QuantConnect.Securities.Positions.IPositionGroup
PositionGroupKey Key [get]
 Gets the key identifying this group More...
 
decimal Quantity [get]
 Gets the whole number of units in this position group More...
 
IEnumerable< IPositionPositions [get]
 Gets the positions in this group More...
 
IPositionGroupBuyingPowerModel BuyingPowerModel [get]
 Gets the buying power model defining how margin works in this group More...
 

Detailed Description

Provides a default implementation of IPositionGroup

Definition at line 27 of file PositionGroup.cs.

Constructor & Destructor Documentation

◆ PositionGroup() [1/3]

QuantConnect.Securities.Positions.PositionGroup.PositionGroup ( IPositionGroupBuyingPowerModel  buyingPowerModel,
decimal  quantity,
params IPosition[]  positions 
)

Initializes a new instance of the PositionGroup class

Parameters
buyingPowerModelThe buying power model to use for this group
quantityThe group quantity, which must be the ratio of quantity to unit quantity of each position
positionsThe positions comprising this group
Exceptions
ArgumentExceptionThrown when the quantity is not the ratio of quantity to unit quantity of each position

Definition at line 63 of file PositionGroup.cs.

Here is the caller graph for this function:

◆ PositionGroup() [2/3]

QuantConnect.Securities.Positions.PositionGroup.PositionGroup ( PositionGroupKey  key,
decimal  quantity,
params IPosition[]  positions 
)

Initializes a new instance of the PositionGroup class

Parameters
keyThe deterministic key for this group
quantityThe group quantity, which must be the ratio of quantity to unit quantity of each position
positionsThe positions comprising this group
Exceptions
ArgumentExceptionThrown when the quantity is not the ratio of quantity to unit quantity of each position

Definition at line 75 of file PositionGroup.cs.

◆ PositionGroup() [3/3]

QuantConnect.Securities.Positions.PositionGroup.PositionGroup ( PositionGroupKey  key,
decimal  quantity,
Dictionary< Symbol, IPosition positions 
)

Initializes a new instance of the PositionGroup class

Parameters
keyThe deterministic key for this group
quantityThe group quantity, which must be the ratio of quantity to unit quantity of each position
positionsThe positions comprising this group
Exceptions
ArgumentExceptionThrown when the quantity is not the ratio of quantity to unit quantity of each position

Definition at line 87 of file PositionGroup.cs.

Here is the call graph for this function:

Member Function Documentation

◆ TryGetPosition()

bool QuantConnect.Securities.Positions.PositionGroup.TryGetPosition ( Symbol  symbol,
out IPosition  position 
)

Attempts to retrieve the position with the specified symbol

Parameters
symbolThe symbol
positionThe position, if found
Returns
True if the position was found, otherwise false

Implements QuantConnect.Securities.Positions.IPositionGroup.

Definition at line 107 of file PositionGroup.cs.

◆ ToString()

override string QuantConnect.Securities.Positions.PositionGroup.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

Definition at line 114 of file PositionGroup.cs.

◆ GetEnumerator()

IEnumerator<IPosition> QuantConnect.Securities.Positions.PositionGroup.GetEnumerator ( )

Returns an enumerator that iterates through the collection.

Returns
An enumerator that can be used to iterate through the collection.

Definition at line 121 of file PositionGroup.cs.

◆ Empty()

static PositionGroup QuantConnect.Securities.Positions.PositionGroup.Empty ( IPositionGroupBuyingPowerModel  buyingPowerModel)
static

Instantiates a default empty position group instance

Parameters
buyingPowerModelThe buying power model to use for this group

Definition at line 137 of file PositionGroup.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ Count

int QuantConnect.Securities.Positions.PositionGroup.Count => _positions.Count

Gets the number of positions in the group

Definition at line 32 of file PositionGroup.cs.

◆ Positions

IEnumerable<IPosition> QuantConnect.Securities.Positions.PositionGroup.Positions => _positions.Values

Gets the positions in this group

Definition at line 47 of file PositionGroup.cs.

◆ BuyingPowerModel

IPositionGroupBuyingPowerModel QuantConnect.Securities.Positions.PositionGroup.BuyingPowerModel => Key.BuyingPowerModel

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

Definition at line 52 of file PositionGroup.cs.

Property Documentation

◆ Key

PositionGroupKey QuantConnect.Securities.Positions.PositionGroup.Key
get

Gets the key identifying this group

Definition at line 37 of file PositionGroup.cs.

◆ Quantity

decimal QuantConnect.Securities.Positions.PositionGroup.Quantity
get

Gets the whole number of units in this position group

Definition at line 42 of file PositionGroup.cs.


The documentation for this class was generated from the following file: