|
Lean
$LEAN_TAG$
|
Provides a collection type for IPositionGroup More...
Public Member Functions | |
| PositionGroupCollection (Dictionary< PositionGroupKey, IPositionGroup > groups, Dictionary< Symbol, HashSet< IPositionGroup >> groupsBySymbol) | |
| Initializes a new instance of the PositionGroupCollection class More... | |
| PositionGroupCollection (IReadOnlyCollection< IPositionGroup > groups) | |
| Initializes a new instance of the PositionGroupCollection class More... | |
| PositionGroupCollection | Add (IPositionGroup group) |
| Creates a new PositionGroupCollection that contains all of the position groups in this collection in addition to the specified group . If a group with the same key already exists then it is overwritten. More... | |
| bool | Contains (PositionGroupKey key) |
| Determines whether or not a group with the specified key exists in this collection More... | |
| bool | TryGetGroup (PositionGroupKey key, out IPositionGroup group) |
| Attempts to retrieve the group with the specified key More... | |
| bool | TryGetGroups (Symbol symbol, out IReadOnlyCollection< IPositionGroup > groups) |
| Attempts to retrieve all groups that contain the provided symbol More... | |
| PositionGroupCollection | CombineWith (PositionGroupCollection other) |
| Merges this position group collection with the provided other collection. More... | |
| IEnumerator< IPositionGroup > | GetEnumerator () |
| Returns an enumerator that iterates through the collection. More... | |
Public Attributes | |
| int | Count => _groups.Count |
| Gets the number of positions in this group More... | |
Static Public Attributes | |
| static PositionGroupCollection | Empty => new(new Dictionary<PositionGroupKey, IPositionGroup>(), new Dictionary<Symbol, HashSet<IPositionGroup>>()) |
| Gets an empty instance of the PositionGroupCollection class More... | |
Properties | |
| bool | IsOnlyDefaultGroups [get] |
| Gets whether or not this collection contains only default position groups More... | |
| IPositionGroup | this[PositionGroupKey key] [get] |
| Gets the IPositionGroup matching the specified key. If one does not exist, then an empty group is returned matching the unit quantities defined in the key More... | |
Provides a collection type for IPositionGroup
Definition at line 25 of file PositionGroupCollection.cs.
| QuantConnect.Securities.Positions.PositionGroupCollection.PositionGroupCollection | ( | Dictionary< PositionGroupKey, IPositionGroup > | groups, |
| Dictionary< Symbol, HashSet< IPositionGroup >> | groupsBySymbol | ||
| ) |
Initializes a new instance of the PositionGroupCollection class
| groups | The position groups keyed by their group key |
| groupsBySymbol | The position groups keyed by the symbol of each position |
Definition at line 62 of file PositionGroupCollection.cs.
| QuantConnect.Securities.Positions.PositionGroupCollection.PositionGroupCollection | ( | IReadOnlyCollection< IPositionGroup > | groups | ) |
Initializes a new instance of the PositionGroupCollection class
| groups | The position groups |
Definition at line 75 of file PositionGroupCollection.cs.
| PositionGroupCollection QuantConnect.Securities.Positions.PositionGroupCollection.Add | ( | IPositionGroup | group | ) |
Creates a new PositionGroupCollection that contains all of the position groups in this collection in addition to the specified group . If a group with the same key already exists then it is overwritten.
Definition at line 90 of file PositionGroupCollection.cs.
| bool QuantConnect.Securities.Positions.PositionGroupCollection.Contains | ( | PositionGroupKey | key | ) |
Determines whether or not a group with the specified key exists in this collection
| key | The group key to search for |
Definition at line 110 of file PositionGroupCollection.cs.
| bool QuantConnect.Securities.Positions.PositionGroupCollection.TryGetGroup | ( | PositionGroupKey | key, |
| out IPositionGroup | group | ||
| ) |
Attempts to retrieve the group with the specified key
| key | The group key to search for |
| group | The position group |
Definition at line 141 of file PositionGroupCollection.cs.
| bool QuantConnect.Securities.Positions.PositionGroupCollection.TryGetGroups | ( | Symbol | symbol, |
| out IReadOnlyCollection< IPositionGroup > | groups | ||
| ) |
Attempts to retrieve all groups that contain the provided symbol
| symbol | The symbol |
| groups | The groups if any were found, otherwise null |
Definition at line 152 of file PositionGroupCollection.cs.
| PositionGroupCollection QuantConnect.Securities.Positions.PositionGroupCollection.CombineWith | ( | PositionGroupCollection | other | ) |
Merges this position group collection with the provided other collection.
Definition at line 168 of file PositionGroupCollection.cs.
| IEnumerator<IPositionGroup> QuantConnect.Securities.Positions.PositionGroupCollection.GetEnumerator | ( | ) |
Returns an enumerator that iterates through the collection.
Definition at line 190 of file PositionGroupCollection.cs.
|
static |
Gets an empty instance of the PositionGroupCollection class
Definition at line 30 of file PositionGroupCollection.cs.
| int QuantConnect.Securities.Positions.PositionGroupCollection.Count => _groups.Count |
Gets the number of positions in this group
Definition at line 35 of file PositionGroupCollection.cs.
|
get |
Gets whether or not this collection contains only default position groups
Definition at line 41 of file PositionGroupCollection.cs.
|
get |
Gets the IPositionGroup matching the specified key. If one does not exist, then an empty group is returned matching the unit quantities defined in the key
| key | The position group key to search for |
Definition at line 122 of file PositionGroupCollection.cs.