Lean
$LEAN_TAG$
|
Provides a collection for managing IPortfolioTargets for each symbol More...
Public Member Functions | |
void | Add (IPortfolioTarget target) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten. More... | |
void | Add (KeyValuePair< Symbol, IPortfolioTarget > target) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten. More... | |
void | Add (Symbol symbol, IPortfolioTarget target) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten. More... | |
void | AddRange (IEnumerable< IPortfolioTarget > targets) |
Adds the specified targets to the collection. If a target for the same symbol already exists it will be overwritten. More... | |
void | AddRange (IPortfolioTarget[] targets) |
Adds the specified targets to the collection. If a target for the same symbol already exists it will be overwritten. More... | |
void | Clear () |
Removes all portfolio targets from this collection More... | |
void | ClearFulfilled (IAlgorithm algorithm) |
Removes fulfilled portfolio targets from this collection. Will only take into account actual holdings and ignore open orders. More... | |
bool | Contains (IPortfolioTarget target) |
Determines whether or not the specified target exists in this collection. NOTE: This checks for the exact specified target, not by symbol. Use ContainsKey to check by symbol. More... | |
bool | Contains (KeyValuePair< Symbol, IPortfolioTarget > target) |
Determines whether the specified symbol/target pair exists in this collection More... | |
bool | ContainsKey (Symbol symbol) |
Determines whether the specified symbol exists as a key in this collection More... | |
void | CopyTo (IPortfolioTarget[] array, int arrayIndex) |
Copies the targets in this collection to the specified array More... | |
void | CopyTo (KeyValuePair< Symbol, IPortfolioTarget >[] array, int arrayIndex) |
Copies the targets in this collection to the specified array More... | |
bool | Remove (Symbol symbol) |
Removes the target for the specified symbol if it exists in this collection. More... | |
bool | Remove (KeyValuePair< Symbol, IPortfolioTarget > target) |
Removes the target for the specified symbol/target pair if it exists in this collection. More... | |
bool | Remove (IPortfolioTarget target) |
Removes the target if it exists in this collection. More... | |
bool | TryGetValue (Symbol symbol, out IPortfolioTarget target) |
Attempts to retrieve the target for the specified symbol More... | |
IEnumerator< IPortfolioTarget > | GetEnumerator () |
Gets an enumerator to iterator over all portfolio targets in this collection. This is the default enumerator for this collection. More... | |
IEnumerable< IPortfolioTarget > | OrderByMarginImpact (IAlgorithm algorithm) |
Returned an ordered enumerable where position reducing orders are executed first and the remaining orders are executed in decreasing order value. Will NOT return targets for securities that have no data yet. Will NOT return targets for which current holdings + open orders quantity, sum up to the target quantity More... | |
Public Attributes | |
bool | IsReadOnly => false |
Gets false . This collection is not read-only. More... | |
Properties | |
int | Count [get] |
Gets the number of targets in this collection More... | |
bool | IsEmpty [get] |
True if there is no target in the collection More... | |
ICollection< Symbol > | Keys [get] |
Gets the symbol keys for this collection More... | |
ICollection< IPortfolioTarget > | Values [get] |
Gets all portfolio targets in this collection Careful, will return targets for securities that might have no data yet. More... | |
IPortfolioTarget | this[Symbol symbol] [get, set] |
Gets or sets the portfolio target for the specified symbol More... | |
Provides a collection for managing IPortfolioTargets for each symbol
Definition at line 27 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Add | ( | IPortfolioTarget | target | ) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten.
target | The portfolio target to add |
Definition at line 105 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Add | ( | KeyValuePair< Symbol, IPortfolioTarget > | target | ) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten.
target | The portfolio target to add |
Definition at line 125 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Add | ( | Symbol | symbol, |
IPortfolioTarget | target | ||
) |
Adds the specified target to the collection. If a target for the same symbol already exists it wil be overwritten.
symbol | The symbol key |
target | The portfolio target to add |
Definition at line 136 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.AddRange | ( | IEnumerable< IPortfolioTarget > | targets | ) |
Adds the specified targets to the collection. If a target for the same symbol already exists it will be overwritten.
targets | The portfolio targets to add |
Definition at line 146 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.AddRange | ( | IPortfolioTarget[] | targets | ) |
Adds the specified targets to the collection. If a target for the same symbol already exists it will be overwritten.
targets | The portfolio targets to add |
Definition at line 164 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Clear | ( | ) |
Removes all portfolio targets from this collection
Definition at line 172 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.ClearFulfilled | ( | IAlgorithm | algorithm | ) |
Removes fulfilled portfolio targets from this collection. Will only take into account actual holdings and ignore open orders.
Definition at line 186 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Contains | ( | IPortfolioTarget | target | ) |
Determines whether or not the specified target exists in this collection. NOTE: This checks for the exact specified target, not by symbol. Use ContainsKey to check by symbol.
target | The portfolio target to check for existence. |
Definition at line 207 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Contains | ( | KeyValuePair< Symbol, IPortfolioTarget > | target | ) |
Determines whether the specified symbol/target pair exists in this collection
target | The symbol/target pair |
Definition at line 225 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.ContainsKey | ( | Symbol | symbol | ) |
Determines whether the specified symbol exists as a key in this collection
symbol | The symbol key |
Definition at line 235 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.CopyTo | ( | IPortfolioTarget[] | array, |
int | arrayIndex | ||
) |
Copies the targets in this collection to the specified array
array | The destination array to copy to |
arrayIndex | The index in the array to start copying to |
Definition at line 248 of file PortfolioTargetCollection.cs.
void QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.CopyTo | ( | KeyValuePair< Symbol, IPortfolioTarget >[] | array, |
int | arrayIndex | ||
) |
Copies the targets in this collection to the specified array
array | The destination array to copy to |
arrayIndex | The index in the array to start copying to |
Definition at line 261 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Remove | ( | Symbol | symbol | ) |
Removes the target for the specified symbol if it exists in this collection.
symbol | The symbol to remove |
Definition at line 271 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Remove | ( | KeyValuePair< Symbol, IPortfolioTarget > | target | ) |
Removes the target for the specified symbol/target pair if it exists in this collection.
target | The symbol/target pair to remove |
Definition at line 290 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.Remove | ( | IPortfolioTarget | target | ) |
Removes the target if it exists in this collection.
target | The target to remove |
Definition at line 300 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.TryGetValue | ( | Symbol | symbol, |
out IPortfolioTarget | target | ||
) |
Attempts to retrieve the target for the specified symbol
symbol | The symbol |
target | The portfolio target for the symbol, or null if not found |
Definition at line 329 of file PortfolioTargetCollection.cs.
IEnumerator<IPortfolioTarget> QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.GetEnumerator | ( | ) |
Gets an enumerator to iterator over all portfolio targets in this collection. This is the default enumerator for this collection.
Definition at line 384 of file PortfolioTargetCollection.cs.
IEnumerable<IPortfolioTarget> QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.OrderByMarginImpact | ( | IAlgorithm | algorithm | ) |
Returned an ordered enumerable where position reducing orders are executed first and the remaining orders are executed in decreasing order value. Will NOT return targets for securities that have no data yet. Will NOT return targets for which current holdings + open orders quantity, sum up to the target quantity
algorithm | The algorithm instance |
Definition at line 426 of file PortfolioTargetCollection.cs.
bool QuantConnect.Algorithm.Framework.Portfolio.PortfolioTargetCollection.IsReadOnly => false |
Gets false
. This collection is not read-only.
Definition at line 64 of file PortfolioTargetCollection.cs.
|
get |
Gets the number of targets in this collection
Definition at line 37 of file PortfolioTargetCollection.cs.
|
get |
True if there is no target in the collection
Definition at line 51 of file PortfolioTargetCollection.cs.
|
get |
Gets the symbol keys for this collection
Definition at line 70 of file PortfolioTargetCollection.cs.
|
get |
Gets all portfolio targets in this collection Careful, will return targets for securities that might have no data yet.
Definition at line 85 of file PortfolioTargetCollection.cs.
|
getset |
Gets or sets the portfolio target for the specified symbol
symbol | The symbol |
Definition at line 343 of file PortfolioTargetCollection.cs.