17 using System.Collections.Generic;
18 using System.Runtime.CompilerServices;
31 public static partial class Messages
98 [MethodImpl(MethodImplOptions.AggressiveInlining)]
101 return Invariant($
"{instance.Time:o} - {instance.y}");
113 [MethodImpl(MethodImplOptions.AggressiveInlining)]
116 return Invariant($
@"{instance.Time:o} - (O:{instance.Open} H: {instance.High} L: {
117 instance.Low} C: {instance.Close})");
129 [MethodImpl(MethodImplOptions.AggressiveInlining)]
132 return $
"The value {value} cannot be converted to a decimal number";
150 "Types deriving from 'ExtendedDictionary' must implement the 'void Remove(Symbol) method.";
156 "Types deriving from 'ExtendedDictionary' must implement the 'T this[Symbol] method.";
162 [MethodImpl(MethodImplOptions.AggressiveInlining)]
165 return $
"Clear/clear method call is an invalid operation. {instance.GetType().Name} is a read-only collection.";
172 [MethodImpl(MethodImplOptions.AggressiveInlining)]
175 return $
"Remove/pop method call is an invalid operation. {instance.GetType().Name} is a read-only collection.";
182 [MethodImpl(MethodImplOptions.AggressiveInlining)]
185 return $
"The ticker {ticker} was not found in the SymbolCache. Use the Symbol object as key instead. " +
186 "Accessing the securities collection/slice object by string ticker is only available for securities added with " +
187 "the AddSecurity-family methods. For more details, please check out the documentation.";
193 [MethodImpl(MethodImplOptions.AggressiveInlining)]
196 return $
"popitem method is not supported for {instance.GetType().Name}";
203 [MethodImpl(MethodImplOptions.AggressiveInlining)]
206 return $
"'{symbol}' wasn't found in the {instance.GetType().Name} object, likely because there was no-data at this moment in " +
207 "time and it wasn't possible to fillforward historical data. Please check the data exists before accessing it with " +
208 $
"data.ContainsKey(\"{symbol}\"). The collection is read-only, cannot set default.";
215 [MethodImpl(MethodImplOptions.AggressiveInlining)]
218 return $
"update method call is an invalid operation. {instance.GetType().Name} is a read-only collection.";
231 "Adjusting a symbol by an offset is currently only supported for non canonical futures";
237 $
"The provided '{nameof(IDataProvider)}' instance is null. Are you missing some initialization step?";
262 [MethodImpl(MethodImplOptions.AggressiveInlining)]
265 return $
"failed for: '{url}'";
272 [MethodImpl(MethodImplOptions.AggressiveInlining)]
275 return $
"{symbol}: The security does not have an accurate price as it has not yet received a bar of data. " +
276 "Before placing a trade (or using SetHoldings) warm up your algorithm with SetWarmup, or use slice.Contains(symbol) " +
277 "to confirm the Slice object has price before using the data. Data does not necessarily all arrive at the same " +
278 "time so your algorithm should confirm the data is ready before using it. In live trading this can mean you do " +
279 "not have an active subscription to the asset class you're trying to trade. If using custom data make sure you've " +
280 "set the 'Value' property.";
286 [MethodImpl(MethodImplOptions.AggressiveInlining)]
289 return $
"Waiting for '{threadName}' thread to stop...";
295 [MethodImpl(MethodImplOptions.AggressiveInlining)]
298 return $
"Timeout waiting for '{threadName}' thread to stop";
304 [MethodImpl(MethodImplOptions.AggressiveInlining)]
307 return $
"Data type '{type.Name}' missing parameterless constructor. E.g. public {type.Name}() {{ }}";
313 [MethodImpl(MethodImplOptions.AggressiveInlining)]
316 return $
"Failed to create instance of type '{type.Name}'";
323 [MethodImpl(MethodImplOptions.AggressiveInlining)]
326 return $
"Data type '{type.Name}' does not inherit required {nameof(Data.BaseData)}";
333 [MethodImpl(MethodImplOptions.AggressiveInlining)]
336 return Invariant($
@"It is not possible to cast a non-finite floating-point value ({
337 input}) as decimal. Please review math operations and verify the result is valid.");
343 [MethodImpl(MethodImplOptions.AggressiveInlining)]
346 return Invariant($
"Unable to exactly convert time span ('{timeSpan}') to resolution.");
352 [MethodImpl(MethodImplOptions.AggressiveInlining)]
355 return $
"Attempted to parse unknown SecurityType: {value}";
362 [MethodImpl(MethodImplOptions.AggressiveInlining)]
365 return Invariant($
"The SecurityType {securityType} has no default OptionStyle, because it has no options available for it");
371 [MethodImpl(MethodImplOptions.AggressiveInlining)]
374 return $
"Unexpected OptionStyle: {value}";
380 [MethodImpl(MethodImplOptions.AggressiveInlining)]
383 return $
"Unexpected OptionStyle: {value}";
389 [MethodImpl(MethodImplOptions.AggressiveInlining)]
392 return $
"Unexpected OptionRight: {value}";
398 [MethodImpl(MethodImplOptions.AggressiveInlining)]
401 return $
"Unexpected OptionRight: {value}";
407 [MethodImpl(MethodImplOptions.AggressiveInlining)]
410 return $
"Unexpected DataMappingMode: {value}";
416 [MethodImpl(MethodImplOptions.AggressiveInlining)]
419 return $
"{methodName} cannot be used to convert a PyObject into {type}.";
426 [MethodImpl(MethodImplOptions.AggressiveInlining)]
429 return $
"ConvertToDictionary cannot be used to convert a {sourceType} into {targetType}. Reason: {reason}";
436 [MethodImpl(MethodImplOptions.AggressiveInlining)]
439 return $
"Argument type should be Symbol or a list of Symbol. Object: {item}. Type: {item.GetPythonType()}";
445 [MethodImpl(MethodImplOptions.AggressiveInlining)]
448 return $
"{objectRepr} is not a C# Type.";
455 [MethodImpl(MethodImplOptions.AggressiveInlining)]
458 return Invariant($
"RuntimeError at {algorithm.UtcTime} UTC. Context: {context}");
470 [MethodImpl(MethodImplOptions.AggressiveInlining)]
473 var value = Invariant($
@"{instance.Symbol.Value}: {instance.Quantity} @ {
474 instance.CurrencySymbol}{instance.AveragePrice} - Market: {instance.CurrencySymbol}{instance.MarketPrice}");
476 if (instance.ConversionRate != 1m)
478 value += Invariant($
" - Conversion: {instance.ConversionRate}");
505 [MethodImpl(MethodImplOptions.AggressiveInlining)]
508 return $
"Execution Security Error: Memory Usage Maxed Out - {memoryCap}MB max, with last sample of {lastSample}MB.";
514 [MethodImpl(MethodImplOptions.AggressiveInlining)]
517 return Invariant($
"Execution Security Error: Memory usage over 80% capacity. Sampled at {lastSample}");
524 [MethodImpl(MethodImplOptions.AggressiveInlining)]
525 public static string MemoryUsageInfo(
string memoryUsed,
string lastSample,
string memoryUsedByApp, TimeSpan currentTimeStepElapsed,
528 return Invariant($
@"Used: {memoryUsed}, Sample: {lastSample}, App: {memoryUsedByApp}, CurrentTimeStepElapsed: {
529 currentTimeStepElapsed:mm':'ss'.'fff}. CPU: {cpuUsage}%");
536 [MethodImpl(MethodImplOptions.AggressiveInlining)]
539 return $
@"Execution Security Error: Operation timed out - {
540 timeout.TotalMinutes.ToStringInvariant()} minutes max. Check for recursive loops.";
552 [MethodImpl(MethodImplOptions.AggressiveInlining)]
555 return $
"The market identifier is limited to positive values less than {maxMarketIdentifier.ToStringInvariant()}.";
561 [MethodImpl(MethodImplOptions.AggressiveInlining)]
564 return $
"Attempted to add an already added market with a different identifier. Market: {market}";
571 [MethodImpl(MethodImplOptions.AggressiveInlining)]
574 return $
"Attempted to add a market identifier that is already in use. New Market: {market} Existing Market: {existingMarket}";
581 public static class OS
617 [MethodImpl(MethodImplOptions.AggressiveInlining)]
620 return $
"The provided value ({input}) was not parseable as {targetType.Name}";
633 "No underlying specified for this identifier. Check that HasUnderlying is true before accessing the Underlying property.";
639 "Date is only defined for SecurityType.Equity, SecurityType.Option, SecurityType.Future, SecurityType.FutureOption, SecurityType.IndexOption, and SecurityType.Base";
645 "StrikePrice is only defined for SecurityType.Option, SecurityType.FutureOption, and SecurityType.IndexOption";
651 "OptionRight is only defined for SecurityType.Option, SecurityType.FutureOption, and SecurityType.IndexOption";
657 "OptionStyle is only defined for SecurityType.Option, SecurityType.FutureOption, and SecurityType.IndexOption";
662 public static string NullSymbol =
"SecurityIdentifier requires a non-null string 'symbol'";
687 [MethodImpl(MethodImplOptions.AggressiveInlining)]
690 return $
"{parameterName} must be between 0 and 99";
696 [MethodImpl(MethodImplOptions.AggressiveInlining)]
699 return $
"{parameterName} must be either 0 or 1";
705 [MethodImpl(MethodImplOptions.AggressiveInlining)]
708 return Invariant($
"The specified strike price's precision is too high: {strikePrice}");
714 [MethodImpl(MethodImplOptions.AggressiveInlining)]
717 return Invariant($
"Error parsing SecurityIdentifier: '{value}', Exception: {exception}");
723 [MethodImpl(MethodImplOptions.AggressiveInlining)]
726 return $
@"The specified market wasn't found in the markets lookup. Requested: {
727 market}. You can add markets by calling QuantConnect.Market.Add(string,int)";
739 [MethodImpl(MethodImplOptions.AggressiveInlining)]
742 return $
"StringExtensions.ConvertInvariant does not support converting to TypeCode.{targetTypeCode}";
755 "Cannot create future option Symbol using this method (insufficient information). Use `CreateOption(Symbol, ...)` instead.";
761 "Canonical is only defined for SecurityType.Option, SecurityType.Future, SecurityType.FutureOption";
771 [MethodImpl(MethodImplOptions.AggressiveInlining)]
774 return Invariant($
"The security type has not been implemented yet: {securityType}");
780 [MethodImpl(MethodImplOptions.AggressiveInlining)]
783 return Invariant($
"SecurityType {securityType} can not be mapped.");
789 [MethodImpl(MethodImplOptions.AggressiveInlining)]
792 return Invariant($
"No option type exists for underlying SecurityType: {securityType}");
798 [MethodImpl(MethodImplOptions.AggressiveInlining)]
801 return Invariant($
"No underlying type exists for option SecurityType: {securityType}");
804 [MethodImpl(MethodImplOptions.AggressiveInlining)]
807 return Invariant($
"The provided SecurityIdentifier is not for an option: {sid}");
810 [MethodImpl(MethodImplOptions.AggressiveInlining)]
813 return Invariant($
"The provided SecurityIdentifier does not match the underlying symbol: {sid} != {underlying.ID}");
825 [MethodImpl(MethodImplOptions.AggressiveInlining)]
828 return $
"We were unable to locate the ticker '{ticker}'.";
834 [MethodImpl(MethodImplOptions.AggressiveInlining)]
837 return "We located multiple potentially matching tickers. " +
838 "For custom data, be sure to append a dot followed by the custom data type name. " +
839 $
"For example: 'BTC.Bitcoin'. Potential Matches: {string.Join(",
", tickers)}";
851 [MethodImpl(MethodImplOptions.AggressiveInlining)]
854 return $
"Failed to get market for future '{ticker}' and underlying '{underlying}'";
860 [MethodImpl(MethodImplOptions.AggressiveInlining)]
863 return $
"No market found for '{ticker}'";
869 [MethodImpl(MethodImplOptions.AggressiveInlining)]
872 return Invariant($
"{methodName} expects symbol to be an option, received {securityType}.");
878 [MethodImpl(MethodImplOptions.AggressiveInlining)]
881 return $
"Invalid ticker format {ticker}";
887 [MethodImpl(MethodImplOptions.AggressiveInlining)]
890 return Invariant($
"Security type {securityType} not implemented");
908 "The SymbolValueJsonConverter is intended to be decorated on the appropriate member directly.";
919 public static string InvalidBarSize =
"barSize must be greater than TimeSpan.Zero";
924 [MethodImpl(MethodImplOptions.AggressiveInlining)]
927 return $
"Security Count: {count}";
939 [MethodImpl(MethodImplOptions.AggressiveInlining)]
942 return Invariant($
@"Total days is negative ({
944 }), indicating reverse start and end times. Check your usage of TradingCalendar to ensure proper arrangement of variables");