Lean
$LEAN_TAG$
|
Provides a collection type for IPosition aimed at providing indexing for common operations required by the resolver implementations. More...
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< IPosition > | GetEnumerator () |
Returns an enumerator that iterates through the collection. More... | |
Public Attributes | |
int | Count => _positions.Count |
Gets the number of elements in the collection. More... | |
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.
QuantConnect.Securities.Positions.PositionCollection.PositionCollection | ( | Dictionary< Symbol, IPosition > | positions | ) |
Initializes a new instance of the PositionCollection class
positions | The positions to include in this collection |
Definition at line 39 of file PositionCollection.cs.
QuantConnect.Securities.Positions.PositionCollection.PositionCollection | ( | IEnumerable< IPosition > | positions | ) |
Initializes a new instance of the PositionCollection class
positions | The positions to include in this collection |
Definition at line 48 of file PositionCollection.cs.
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.
groups | The resolved position groups |
Definition at line 61 of file PositionCollection.cs.
void QuantConnect.Securities.Positions.PositionCollection.Clear | ( | ) |
Clears this collection of all positions
Definition at line 90 of file PositionCollection.cs.
bool QuantConnect.Securities.Positions.PositionCollection.TryGetPosition | ( | Symbol | symbol, |
out IPosition | position | ||
) |
Attempts to retrieve the position with the specified symbol from this collection
symbol | The symbol |
position | The position |
Definition at line 101 of file PositionCollection.cs.
IEnumerator<IPosition> QuantConnect.Securities.Positions.PositionCollection.GetEnumerator | ( | ) |
Returns an enumerator that iterates through the collection.
Definition at line 108 of file PositionCollection.cs.
int QuantConnect.Securities.Positions.PositionCollection.Count => _positions.Count |
Gets the number of elements in the collection.
Definition at line 33 of file PositionCollection.cs.