Lean  $LEAN_TAG$
Messages.Commands.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;
18 using QuantConnect.Orders;
19 
20 using static QuantConnect.StringExtensions;
21 
22 namespace QuantConnect
23 {
24  /// <summary>
25  /// Provides user-facing message construction methods and static messages for the <see cref="Commands"/> namespace
26  /// </summary>
27  public static partial class Messages
28  {
29  /// <summary>
30  /// Provides user-facing messages for the <see cref="Commands.BaseCommand"/> class and its consumers or related classes
31  /// </summary>
32  public static class BaseCommand
33  {
34  public static string MissingValuesToGetSymbol = "Please provide values for: Ticker, Market & SecurityType";
35  }
36 
37  /// <summary>
38  /// Provides user-facing messages for the <see cref="Commands.BaseCommandHandler"/> class and its consumers or related classes
39  /// </summary>
40  public static class BaseCommandHandler
41  {
42  [MethodImpl(MethodImplOptions.AggressiveInlining)]
43  public static string ExecutingCommand(ICommand command)
44  {
45  return $"Executing {command}";
46  }
47  }
48 
49  /// <summary>
50  /// Provides user-facing messages for the <see cref="Commands.FileCommandHandler"/> class and its consumers or related classes
51  /// </summary>
52  public static class FileCommandHandler
53  {
54  public static string NullOrEmptyCommandId = "Command Id is null or empty, will skip writing result file";
55 
56  [MethodImpl(MethodImplOptions.AggressiveInlining)]
57  public static string ReadingCommandFile(string commandFilePath)
58  {
59  return $"Reading command file {commandFilePath}";
60  }
61 
62  [MethodImpl(MethodImplOptions.AggressiveInlining)]
63  public static string CommandFileDoesNotExist(string commandFilePath)
64  {
65  return $"File {commandFilePath} does not exists";
66  }
67  }
68 
69  /// <summary>
70  /// Provides user-facing messages for the <see cref="Commands.OrderCommand"/> class and its consumers or related classes
71  /// </summary>
72  public static class OrderCommand
73  {
74  [MethodImpl(MethodImplOptions.AggressiveInlining)]
75  public static string CommandInfo(OrderType orderType, QuantConnect.Symbol symbol, decimal quantity, Orders.OrderResponse response)
76  {
77  return Invariant($"{orderType} for {quantity} units of {symbol}: {response}");
78  }
79  }
80  }
81 }