Lean  $LEAN_TAG$
LiveAlgorithm.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 using System;
16 using System.Collections.Generic;
17 using Newtonsoft.Json;
18 
19 namespace QuantConnect.Api
20 {
22  {
23  /// <summary>
24  /// Project id for the live instance
25  /// </summary>
26  [JsonProperty(PropertyName = "projectId")]
27  public int ProjectId { get; set; }
28 
29  /// <summary>
30  /// Unique live algorithm deployment identifier (similar to a backtest id).
31  /// </summary>
32  [JsonProperty(PropertyName = "deployId")]
33  public string DeployId { get; set; }
34  }
35 
37  {
38  /// <summary>
39  /// The version of the Lean used to run the algorithm
40  /// </summary>
41  [JsonProperty(PropertyName = "versionId")]
42  public int VersionId { get; set; }
43 
44  /// <summary>
45  /// Id of the node that will run the algorithm
46  /// </summary>
47  [JsonProperty(PropertyName = "source")]
48  public string Source { get; set; }
49 
50  /// <summary>
51  /// HTTP status response code
52  /// </summary>
53  [JsonProperty(PropertyName = "responseCode")]
54  public string ResponseCode { get; set; }
55  }
56 
57  /// <summary>
58  /// Response from List Live Algorithms request to QuantConnect Rest API.
59  /// </summary>
61  {
62  /// <summary>
63  /// Algorithm status: running, stopped or runtime error.
64  /// </summary>
65  [JsonProperty(PropertyName = "status")]
66  public AlgorithmStatus Status { get; set; }
67 
68  /// <summary>
69  /// Datetime the algorithm was launched in UTC.
70  /// </summary>
71  [JsonProperty(PropertyName = "launched")]
72  public DateTime Launched { get; set; }
73 
74  /// <summary>
75  /// Datetime the algorithm was stopped in UTC, null if its still running.
76  /// </summary>
77  [JsonProperty(PropertyName = "stopped")]
78  public DateTime? Stopped { get; set; }
79 
80  /// <summary>
81  /// Brokerage
82  /// </summary>
83  [JsonProperty(PropertyName = "brokerage")]
84  public string Brokerage { get; set; }
85 
86  /// <summary>
87  /// Chart we're subscribed to
88  /// </summary>
89  /// <remarks>
90  /// Data limitations mean we can only stream one chart at a time to the consumer. See which chart you're watching here.
91  /// </remarks>
92  [JsonProperty(PropertyName = "subscription")]
93  public string Subscription { get; set; }
94 
95  /// <summary>
96  /// Live algorithm error message from a crash or algorithm runtime error.
97  /// </summary>
98  [JsonProperty(PropertyName = "error")]
99  public string Error { get; set; }
100  }
101 
102  /// <summary>
103  /// List of the live algorithms running which match the requested status
104  /// </summary>
105  public class LiveList : RestResponse
106  {
107  /// <summary>
108  /// Algorithm list matching the requested status.
109  /// </summary>
110  [JsonProperty(PropertyName = "live")]
111  public List<LiveAlgorithmSummary> Algorithms { get; set; }
112  }
113 }