|
Lean
$LEAN_TAG$
|
Provides a means of keeping track of the different cash holdings of an algorithm More...
Public Member Functions | |
| CashBook () | |
| Initializes a new instance of the CashBook class. More... | |
| Cash | Add (string symbol, decimal quantity, decimal conversionRate) |
| Adds a new cash of the specified symbol and quantity More... | |
| List< SubscriptionDataConfig > | EnsureCurrencyDataFeeds (SecurityManager securities, SubscriptionManager subscriptions, IReadOnlyDictionary< SecurityType, string > marketMap, SecurityChanges changes, ISecurityService securityService, Resolution defaultResolution=Resolution.Minute) |
| Checks the current subscriptions and adds necessary currency pair feeds to provide real time conversion data More... | |
| decimal | Convert (decimal sourceQuantity, string sourceCurrency, string destinationCurrency) |
| Converts a quantity of source currency units into the specified destination currency More... | |
| decimal | ConvertToAccountCurrency (decimal sourceQuantity, string sourceCurrency) |
| Converts a quantity of source currency units into the account currency More... | |
| override string | ToString () |
| Returns a string that represents the current object. More... | |
| void | Add (KeyValuePair< string, Cash > item) |
| Add the specified item to this CashBook. More... | |
| void | Add (string symbol, Cash value) |
| Add the specified key and value. More... | |
| void | Clear () |
| Clear this instance of all Cash entries. More... | |
| bool | Remove (string symbol) |
| Remove the Cash item corresponding to the specified symbol More... | |
| bool | Remove (KeyValuePair< string, Cash > item) |
| Remove the specified item. More... | |
| bool | ContainsKey (string symbol) |
| Determines whether the current instance contains an entry with the specified symbol. More... | |
| bool | TryGetValue (string symbol, out Cash value) |
| Try to get the value. More... | |
| bool | Contains (KeyValuePair< string, Cash > item) |
| Determines whether the current collection contains the specified value. More... | |
| void | CopyTo (KeyValuePair< string, Cash >[] array, int arrayIndex) |
| Copies to the specified array. More... | |
| IEnumerator< KeyValuePair< string, Cash > > | GetEnumerator () |
| Gets the enumerator. More... | |
| CashAmount | ConvertToAccountCurrency (CashAmount cashAmount) |
| Converts a cash amount to the account currency More... | |
Public Attributes | |
| ICollection< string > | Keys => _currencies.Keys |
| Gets the keys. More... | |
| ICollection< Cash > | Values => _currencies.Values |
| Gets the values. More... | |
Properties | |
| string | AccountCurrency [get, set] |
| Gets the base currency used More... | |
| decimal | TotalValueInAccountCurrency [get] |
| Gets the total value of the cash book in units of the base currency More... | |
| int | Count [get] |
| Gets the count of Cash items in this CashBook. More... | |
| bool | IsReadOnly [get] |
| Gets a value indicating whether this instance is read only. More... | |
| Cash | this[string symbol] [get, set] |
| Gets or sets the QuantConnect.Securities.Cash with the specified symbol. More... | |
Properties inherited from QuantConnect.Securities.ICurrencyConverter | |
| string | AccountCurrency [get] |
| Gets account currency More... | |
Events | |
| EventHandler< CashBookUpdatedEventArgs > | Updated |
| Event fired when a Cash instance is added or removed, and when the Cash.Updated is triggered for the currently hold instances More... | |
Provides a means of keeping track of the different cash holdings of an algorithm
Definition at line 32 of file CashBook.cs.
| QuantConnect.Securities.CashBook.CashBook | ( | ) |
Initializes a new instance of the CashBook class.
Definition at line 86 of file CashBook.cs.
| Cash QuantConnect.Securities.CashBook.Add | ( | string | symbol, |
| decimal | quantity, | ||
| decimal | conversionRate | ||
| ) |
Adds a new cash of the specified symbol and quantity
| symbol | The symbol used to reference the new cash |
| quantity | The amount of new cash to start |
| conversionRate | The conversion rate used to determine the initial portfolio value/starting capital impact caused by this currency position. |
Definition at line 100 of file CashBook.cs.
| List<SubscriptionDataConfig> QuantConnect.Securities.CashBook.EnsureCurrencyDataFeeds | ( | SecurityManager | securities, |
| SubscriptionManager | subscriptions, | ||
| IReadOnlyDictionary< SecurityType, string > | marketMap, | ||
| SecurityChanges | changes, | ||
| ISecurityService | securityService, | ||
| Resolution | defaultResolution = Resolution.Minute |
||
| ) |
Checks the current subscriptions and adds necessary currency pair feeds to provide real time conversion data
| securities | The SecurityManager for the algorithm |
| subscriptions | The SubscriptionManager for the algorithm |
| marketMap | The market map that decides which market the new security should be in |
| changes | Will be used to consume SecurityChanges.AddedSecurities |
| securityService | Will be used to create required new Security |
| defaultResolution | The default resolution to use for the internal subscriptions |
Definition at line 117 of file CashBook.cs.
| decimal QuantConnect.Securities.CashBook.Convert | ( | decimal | sourceQuantity, |
| string | sourceCurrency, | ||
| string | destinationCurrency | ||
| ) |
Converts a quantity of source currency units into the specified destination currency
| sourceQuantity | The quantity of source currency to be converted |
| sourceCurrency | The source currency symbol |
| destinationCurrency | The destination currency symbol |
Definition at line 155 of file CashBook.cs.
| decimal QuantConnect.Securities.CashBook.ConvertToAccountCurrency | ( | decimal | sourceQuantity, |
| string | sourceCurrency | ||
| ) |
Converts a quantity of source currency units into the account currency
| sourceQuantity | The quantity of source currency to be converted |
| sourceCurrency | The source currency symbol |
Definition at line 185 of file CashBook.cs.
| override string QuantConnect.Securities.CashBook.ToString | ( | ) |
Returns a string that represents the current object.
<filterpriority>2</filterpriority>
Definition at line 201 of file CashBook.cs.
| void QuantConnect.Securities.CashBook.Add | ( | KeyValuePair< string, Cash > | item | ) |
Add the specified item to this CashBook.
| item | KeyValuePair of symbol -> Cash item |
Definition at line 233 of file CashBook.cs.
| void QuantConnect.Securities.CashBook.Add | ( | string | symbol, |
| Cash | value | ||
| ) |
Add the specified key and value.
| symbol | The symbol of the Cash value. |
| value | Value. |
Definition at line 243 of file CashBook.cs.
| void QuantConnect.Securities.CashBook.Clear | ( | ) |
Clear this instance of all Cash entries.
Definition at line 251 of file CashBook.cs.
| bool QuantConnect.Securities.CashBook.Remove | ( | string | symbol | ) |
Remove the Cash item corresponding to the specified symbol
| symbol | The symbolto be removed |
Definition at line 261 of file CashBook.cs.
| bool QuantConnect.Securities.CashBook.Remove | ( | KeyValuePair< string, Cash > | item | ) |
Remove the specified item.
| item | Item. |
Definition at line 270 of file CashBook.cs.
| bool QuantConnect.Securities.CashBook.ContainsKey | ( | string | symbol | ) |
Determines whether the current instance contains an entry with the specified symbol.
true, if key was contained, false otherwise.| symbol | Key. |
Definition at line 280 of file CashBook.cs.
| bool QuantConnect.Securities.CashBook.TryGetValue | ( | string | symbol, |
| out Cash | value | ||
| ) |
Try to get the value.
To be added.
true, if get value was tryed, false otherwise.| symbol | The symbol. |
| value | Value. |
Definition at line 292 of file CashBook.cs.
| bool QuantConnect.Securities.CashBook.Contains | ( | KeyValuePair< string, Cash > | item | ) |
Determines whether the current collection contains the specified value.
| item | Item. |
Definition at line 301 of file CashBook.cs.
| void QuantConnect.Securities.CashBook.CopyTo | ( | KeyValuePair< string, Cash >[] | array, |
| int | arrayIndex | ||
| ) |
Copies to the specified array.
| array | Array. |
| arrayIndex | Array index. |
Definition at line 311 of file CashBook.cs.
| IEnumerator<KeyValuePair<string, Cash> > QuantConnect.Securities.CashBook.GetEnumerator | ( | ) |
| CashAmount QuantConnect.Securities.CashBook.ConvertToAccountCurrency | ( | CashAmount | cashAmount | ) |
Converts a cash amount to the account currency
| cashAmount | The CashAmount instance to convert |
Implements QuantConnect.Securities.ICurrencyConverter.
Definition at line 376 of file CashBook.cs.
| ICollection<string> QuantConnect.Securities.CashBook.Keys => _currencies.Keys |
| ICollection<Cash> QuantConnect.Securities.CashBook.Values => _currencies.Values |
|
getset |
Gets the base currency used
Definition at line 46 of file CashBook.cs.
|
get |
Gets the total value of the cash book in units of the base currency
Definition at line 76 of file CashBook.cs.
|
get |
Gets the count of Cash items in this CashBook.
The count.
Definition at line 213 of file CashBook.cs.
|
get |
Gets a value indicating whether this instance is read only.
true if this instance is read only; otherwise, false.
Definition at line 225 of file CashBook.cs.
|
getset |
Gets or sets the QuantConnect.Securities.Cash with the specified symbol.
| symbol | Symbol. |
Definition at line 321 of file CashBook.cs.
| EventHandler<CashBookUpdatedEventArgs> QuantConnect.Securities.CashBook.Updated |
Event fired when a Cash instance is added or removed, and when the Cash.Updated is triggered for the currently hold instances
Definition at line 40 of file CashBook.cs.