Lean  $LEAN_TAG$
Messages.Indicators.cs
1 /*
2  * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
3  * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14 */
15 
16 using System;
17 using System.Runtime.CompilerServices;
18 
19 using static QuantConnect.StringExtensions;
20 
21 namespace QuantConnect
22 {
23  /// <summary>
24  /// Provides user-facing message construction methods and static messages for the <see cref="Indicators"/> namespace
25  /// </summary>
26  public static partial class Messages
27  {
28  /// <summary>
29  /// Provides user-facing messages for the <see cref="Indicators.IndicatorDataPoint"/> class and its consumers or related classes
30  /// </summary>
31  public static class IndicatorDataPoint
32  {
33  [MethodImpl(MethodImplOptions.AggressiveInlining)]
34  public static string InvalidObjectTypeToCompareTo(Type type)
35  {
36  return $"Object must be of type {type.GetBetterTypeName()}";
37  }
38 
39  [MethodImpl(MethodImplOptions.AggressiveInlining)]
40  public static string ToString(Indicators.IndicatorDataPoint instance)
41  {
42  return Invariant($"{instance.Time.ToStringInvariant("s")} - {instance.Value}");
43  }
44 
45  [MethodImpl(MethodImplOptions.AggressiveInlining)]
46  public static string UnsupportedMethod(string methodName)
47  {
48  return $"IndicatorDataPoint does not support the {methodName} function. This function should never be called on this type.";
49  }
50  }
51 
52  /// <summary>
53  /// Provides user-facing messages for the <see cref="Indicators.RollingWindow{T}"/> class and its consumers or related classes
54  /// </summary>
55  public static class RollingWindow
56  {
57  public static string InvalidSize = "RollingWindow must have size of at least 1.";
58 
59  public static string NoItemsRemovedYet = "No items have been removed yet!";
60 
61  public static string IndexOutOfSizeRange = "Index must be a non-negative integer";
62  }
63  }
64 }