Lean  $LEAN_TAG$
LiveAlgorithmResults.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 Newtonsoft.Json;
17 using Newtonsoft.Json.Converters;
18 using QuantConnect.Packets;
19 using System;
20 using System.Collections.Generic;
21 
22 namespace QuantConnect.Api
23 {
24  /// <summary>
25  /// Details a live algorithm from the "live/read" Api endpoint
26  /// </summary>
28  {
29  /// <summary>
30  /// Error message
31  /// </summary>
32  [JsonProperty(PropertyName = "message")]
33  public string Message { get; set; }
34 
35  /// <summary>
36  /// Indicates the status of the algorihtm, i.e. 'Running', 'Stopped'
37  /// </summary>
38  [JsonProperty(PropertyName = "status")]
39  public string Status { get; set; }
40 
41  /// <summary>
42  /// Algorithm deployment ID
43  /// </summary>
44  [JsonProperty(PropertyName = "deployId")]
45  public string DeployId { get; set; }
46 
47  /// <summary>
48  /// The snapshot project ID for cloning the live development's source code.
49  /// </summary>
50  [JsonProperty(PropertyName = "cloneId")]
51  public int CloneId { get; set; }
52 
53  /// <summary>
54  /// Date the live algorithm was launched
55  /// </summary>
56  [JsonProperty(PropertyName = "launched")]
57  public DateTime Launched { get; set; }
58 
59  /// <summary>
60  /// Date the live algorithm was stopped
61  /// </summary>
62  [JsonProperty(PropertyName = "stopped")]
63  public DateTime? Stopped { get; set; }
64 
65  /// <summary>
66  /// Brokerage used in the live algorithm
67  /// </summary>
68  [JsonProperty(PropertyName = "brokerage")]
69  public string Brokerage { get; set; }
70 
71  /// <summary>
72  /// Security types present in the live algorithm
73  /// </summary>
74  [JsonProperty(PropertyName = "securityTypes")]
75  public string SecurityTypes { get; set; }
76 
77  /// <summary>
78  /// Name of the project the live algorithm is in
79  /// </summary>
80  [JsonProperty(PropertyName = "projectName")]
81  public string ProjectName { get; set; }
82 
83  /// <summary>
84  /// Name of the data center where the algorithm is physically located.
85  /// </summary>
86  [JsonProperty(PropertyName = "datacenter")]
87  public string Datacenter { get; set; }
88 
89  /// <summary>
90  /// Indicates if the algorithm is being live shared
91  /// </summary>
92  [JsonProperty(PropertyName = "public")]
93  public bool Public { get; set; }
94 
95  /// <summary>
96  /// Files present in the project in which the algorithm is
97  /// </summary>
98  [JsonProperty(PropertyName = "files")]
99  public List<ProjectFile> Files { get; set; }
100 
101  /// <summary>
102  /// Runtime banner/updating statistics in the title banner of the live algorithm GUI.
103  /// </summary>
104  [JsonProperty(PropertyName = "runtimeStatistics", NullValueHandling = NullValueHandling.Ignore)]
105  public IDictionary<string, string> RuntimeStatistics { get; set; }
106 
107  /// <summary>
108  /// Charts updates for the live algorithm since the last result packet
109  /// </summary>
110  [JsonProperty(PropertyName = "charts", NullValueHandling = NullValueHandling.Ignore)]
111  public IDictionary<string, Chart> Charts { get; set; }
112  }
113 
114  /// <summary>
115  /// Holds information about the state and operation of the live running algorithm
116  /// </summary>
117  public class LiveResultsData
118  {
119  /// <summary>
120  /// Results version
121  /// </summary>
122  [JsonProperty(PropertyName = "version")]
123  public int Version { get; set; }
124 
125  /// <summary>
126  /// Temporal resolution of the results returned from the Api
127  /// </summary>
128  [JsonProperty(PropertyName = "resolution"), JsonConverter(typeof(StringEnumConverter))]
129  public Resolution Resolution { get; set; }
130 
131  /// <summary>
132  /// Class to represent the data groups results return from the Api
133  /// </summary>
134  [JsonProperty(PropertyName = "results")]
135  public LiveResult Results { get; set; }
136  }
137 }