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