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

Provides a collection type for IPosition aimed at providing indexing for common operations required by the resolver implementations. More...

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

Public Member Functions

 PositionCollection (Dictionary< Symbol, IPosition > positions)
 Initializes a new instance of the PositionCollection class More...
 
 PositionCollection (IEnumerable< IPosition > positions)
 Initializes a new instance of the PositionCollection class More...
 
void Remove (IEnumerable< IPositionGroup > groups)
 Removes the quantities in the provided groups from this position collection. This should be called following IPositionGroupResolver has resolved position groups in order to update the collection of positions for the next resolver, if one exists. More...
 
void Clear ()
 Clears this collection of all positions More...
 
bool TryGetPosition (Symbol symbol, out IPosition position)
 Attempts to retrieve the position with the specified symbol from this collection More...
 
IEnumerator< IPositionGetEnumerator ()
 Returns an enumerator that iterates through the collection. More...
 

Public Attributes

int Count => _positions.Count
 Gets the number of elements in the collection. More...
 

Detailed Description

Provides a collection type for IPosition aimed at providing indexing for common operations required by the resolver implementations.

Definition at line 27 of file PositionCollection.cs.

Constructor & Destructor Documentation

◆ PositionCollection() [1/2]

QuantConnect.Securities.Positions.PositionCollection.PositionCollection ( Dictionary< Symbol, IPosition positions)

Initializes a new instance of the PositionCollection class

Parameters
positionsThe positions to include in this collection

Definition at line 39 of file PositionCollection.cs.

◆ PositionCollection() [2/2]

QuantConnect.Securities.Positions.PositionCollection.PositionCollection ( IEnumerable< IPosition positions)

Initializes a new instance of the PositionCollection class

Parameters
positionsThe positions to include in this collection

Definition at line 48 of file PositionCollection.cs.

Member Function Documentation

◆ Remove()

void QuantConnect.Securities.Positions.PositionCollection.Remove ( IEnumerable< IPositionGroup groups)

Removes the quantities in the provided groups from this position collection. This should be called following IPositionGroupResolver has resolved position groups in order to update the collection of positions for the next resolver, if one exists.

Parameters
groupsThe resolved position groups
Returns

Definition at line 61 of file PositionCollection.cs.

Here is the caller graph for this function:

◆ Clear()

void QuantConnect.Securities.Positions.PositionCollection.Clear ( )

Clears this collection of all positions

Definition at line 90 of file PositionCollection.cs.

Here is the caller graph for this function:

◆ TryGetPosition()

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

Attempts to retrieve the position with the specified symbol from this collection

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

Definition at line 101 of file PositionCollection.cs.

◆ GetEnumerator()

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

Returns an enumerator that iterates through the collection.

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

Definition at line 108 of file PositionCollection.cs.

Member Data Documentation

◆ Count

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

Gets the number of elements in the collection.

Returns
The number of elements in the collection.

Definition at line 33 of file PositionCollection.cs.


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