Lean  $LEAN_TAG$
DebugPacket.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 
17 using Newtonsoft.Json;
18 
19 namespace QuantConnect.Packets
20 {
21  /// <summary>
22  /// Send a simple debug message from the users algorithm to the console.
23  /// </summary>
24  public class DebugPacket : Packet
25  {
26  /// <summary>
27  /// String debug message to send to the users console
28  /// </summary>
29  public string Message { get; set; }
30 
31  /// <summary>
32  /// Associated algorithm Id.
33  /// </summary>
34  public string AlgorithmId { get; set; }
35 
36  /// <summary>
37  /// Compile id of the algorithm sending this message
38  /// </summary>
39  public string CompileId { get; set; }
40 
41  /// <summary>
42  /// Project Id for this message
43  /// </summary>
44  public int ProjectId { get; set; }
45 
46  /// <summary>
47  /// True to emit message as a popup notification (toast),
48  /// false to emit message in console as text
49  /// </summary>
50  public bool Toast { get; set; }
51 
52  /// <summary>
53  /// Default constructor for JSON
54  /// </summary>
55  public DebugPacket()
56  : base (PacketType.Debug)
57  { }
58 
59  /// <summary>
60  /// Constructor for inherited types
61  /// </summary>
62  /// <param name="packetType">The type of packet to create</param>
63  protected DebugPacket(PacketType packetType)
64  : base(packetType)
65  { }
66 
67  /// <summary>
68  /// Create a new instance of the notify debug packet:
69  /// </summary>
70  public DebugPacket(int projectId, string algorithmId, string compileId, string message, bool toast = false)
71  : base(PacketType.Debug)
72  {
73  ProjectId = projectId;
74  Message = message;
75  CompileId = compileId;
76  AlgorithmId = algorithmId;
77  Toast = toast;
78  }
79 
80  } // End Work Packet:
81 
82 } // End of Namespace: