Lean  $LEAN_TAG$
Messages.Optimizer.Objectives.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.Runtime.CompilerServices;
17 
18 namespace QuantConnect
19 {
20  /// <summary>
21  /// Provides user-facing message construction methods and static messages for the <see cref="Optimizer.Objectives"/> namespace
22  /// </summary>
23  public static partial class Messages
24  {
25  /// <summary>
26  /// Provides user-facing common messages for the <see cref="Optimizer.Objectives"/> namespace classes
27  /// </summary>
28  public static class OptimizerObjectivesCommon
29  {
30  /// <summary>
31  /// String message saying the backtest result can not be null or empty
32  /// </summary>
33  public static string NullOrEmptyBacktestResult = "Backtest result can not be null or empty.";
34  }
35 
36  /// <summary>
37  /// Provides user-facing messages for the <see cref="Optimizer.Objectives.Constraint"/> class and its consumers or related classes
38  /// </summary>
39  public static class Constraint
40  {
41  /// <summary>
42  /// String message saying the constraint target value is not specified
43  /// </summary>
44  public static string ConstraintTargetValueNotSpecified = "Constraint target value is not specified";
45  }
46 
47  /// <summary>
48  /// Provides user-facing messages for the <see cref="Optimizer.Objectives.ExtremumJsonConverter"/> class and its consumers or related classes
49  /// </summary>
50  public static class ExtremumJsonConverter
51  {
52  /// <summary>
53  /// String message saying it could not recognize target direction
54  /// </summary>
55  public static string UnrecognizedTargetDirection = "Could not recognize target direction";
56  }
57 
58  /// <summary>
59  /// Provides user-facing messages for the <see cref="Optimizer.Objectives.Objective"/> class and its consumers or related classes
60  /// </summary>
61  public static class Objective
62  {
63  /// <summary>
64  /// Null or empty Objective string message
65  /// </summary>
66  public static string NullOrEmptyObjective = "Objective can not be null or empty";
67  }
68 
69  /// <summary>
70  /// Provides user-facing messages for the <see cref="Optimizer.Objectives.Target"/> class and its consumers or related classes
71  /// </summary>
72  public static class Target
73  {
74  /// <summary>
75  /// Parses a Target object into a string message
76  /// </summary>
77  [MethodImpl(MethodImplOptions.AggressiveInlining)]
78  public static string ToString(Optimizer.Objectives.Target instance)
79  {
80  if (instance.TargetValue.HasValue)
81  {
82  return $"Target: {instance.Target} TargetValue: {instance.TargetValue.Value} at: {instance.Current}";
83  }
84  return $"Target: {instance.Target} at: {instance.Current}";
85  }
86  }
87  }
88 }