Lean  $LEAN_TAG$
Project.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 Newtonsoft.Json;
17 using System.Collections.Generic;
18 
19 namespace QuantConnect.Api
20 {
21  /// <summary>
22  /// Collaborator responses
23  /// </summary>
24  public class Collaborator
25  {
26  /// <summary>
27  /// User ID
28  /// </summary>
29  [JsonProperty(PropertyName = "uid")]
30  public int Uid { get; set; }
31 
32  /// <summary>
33  /// Indicate if the user have live control
34  /// </summary>
35  [JsonProperty(PropertyName = "liveControl")]
36  public bool LiveControl { get; set; }
37 
38  /// <summary>
39  /// The permission this user is given. Can be "read"
40  /// or "write"
41  /// </summary>
42  [JsonProperty(PropertyName = "permission")]
43  public string Permission { get; set; }
44 
45  /// <summary>
46  /// The user public ID
47  /// </summary>
48  [JsonProperty(PropertyName = "publicId")]
49  public string PublicId { get; set; }
50 
51  /// <summary>
52  /// The url of the user profile image
53  /// </summary>
54  [JsonProperty(PropertyName = "profileImage")]
55  public string ProfileImage { get; set; }
56 
57  /// <summary>
58  /// The registered email of the user
59  /// </summary>
60  [JsonProperty(PropertyName = "email")]
61  public string Email { get; set; }
62 
63  /// <summary>
64  /// The display name of the user
65  /// </summary>
66  [JsonProperty(PropertyName = "name")]
67  public string Name { get; set; }
68 
69  /// <summary>
70  /// The biography of the user
71  /// </summary>
72  [JsonProperty(PropertyName = "bio")]
73  public string Bio { get; set; }
74 
75  /// <summary>
76  /// Indicate if the user is the owner of the project
77  /// </summary>
78  [JsonProperty(PropertyName = "owner")]
79  public bool Owner { get; set; }
80  }
81 
82  /// <summary>
83  /// Library response
84  /// </summary>
85  public class Library
86  {
87 
88  /// <summary>
89  /// Project Id of the library project
90  /// </summary>
91  [JsonProperty(PropertyName = "projectId")]
92  public int Projectid { get; set; }
93 
94  /// <summary>
95  /// Name of the library project
96  /// </summary>
97  [JsonProperty(PropertyName = "libraryName")]
98  public string LibraryName { get; set; }
99 
100  /// <summary>
101  /// Name of the library project owner
102  /// </summary>
103  [JsonProperty(PropertyName = "ownerName")]
104  public string OwnerName { get; set; }
105 
106  /// <summary>
107  /// Indicate if the library project can be accessed
108  /// </summary>
109  [JsonProperty(PropertyName = "access")]
110  public bool Access { get; set; }
111  }
112 
113  /// <summary>
114  /// The chart display properties
115  /// </summary>
116  public class GridChart
117  {
118  /// <summary>
119  /// The chart name
120  /// </summary>
121  [JsonProperty(PropertyName = "chartName")]
122  public string ChartName { get; set;}
123 
124  /// <summary>
125  /// Width of the chart
126  /// </summary>
127  [JsonProperty(PropertyName = "width")]
128  public int Width { get; set; }
129 
130  /// <summary>
131  /// Height of the chart
132  /// </summary>
133  [JsonProperty(PropertyName = "height")]
134  public int Height { get; set; }
135 
136  /// <summary>
137  /// Number of rows of the chart
138  /// </summary>
139  [JsonProperty(PropertyName = "row")]
140  public int Row { get; set; }
141 
142  /// <summary>
143  /// Number of columns of the chart
144  /// </summary>
145  [JsonProperty(PropertyName = "column")]
146  public int Column { get; set; }
147 
148  /// <summary>
149  /// Sort of the chart
150  /// </summary>
151  [JsonProperty(PropertyName = "sort")]
152  public int Sort { get; set; }
153  }
154 
155  /// <summary>
156  /// The grid arrangement of charts
157  /// </summary>
158  public class Grid
159  {
160  /// <summary>
161  /// List of chart in the xs (Extra small) position
162  /// </summary>
163  [JsonProperty(PropertyName = "xs")]
164  public List<GridChart> Xs { get; set; }
165 
166  /// <summary>
167  /// List of chart in the sm (Small) position
168  /// </summary>
169  [JsonProperty(PropertyName = "sm")]
170  public List<GridChart> Sm { get; set; }
171 
172  /// <summary>
173  /// List of chart in the md (Medium) position
174  /// </summary>
175  [JsonProperty(PropertyName = "md")]
176  public List<GridChart> Md { get; set; }
177 
178  /// <summary>
179  /// List of chart in the lg (Large) position
180  /// </summary>
181  [JsonProperty(PropertyName = "lg")]
182  public List<GridChart> Lg { get; set; }
183 
184  /// <summary>
185  /// List of chart in the xl (Extra large) position
186  /// </summary>
187  [JsonProperty(PropertyName = "xl")]
188  public List<GridChart> Xl { get; set; }
189  }
190 
191  /// <summary>
192  /// Encryption key details
193  /// </summary>
194  public class EncryptionKey
195  {
196  /// <summary>
197  /// Encryption key id
198  /// </summary>
199  [JsonProperty(PropertyName = "id")]
200  public string Id { get; set; }
201 
202  /// <summary>
203  /// Name of the encryption key
204  /// </summary>
205  [JsonProperty(PropertyName = "name")]
206  public string Name { get; set; }
207  }
208 
209  /// <summary>
210  /// Parameter set
211  /// </summary>
212  public class Parameter
213  {
214  /// <summary>
215  /// Name of parameter
216  /// </summary>
217  [JsonProperty(PropertyName = "name")]
218  public string Name { get; set; }
219 
220  /// <summary>
221  /// Value of parameter
222  /// </summary>
223  [JsonProperty(PropertyName = "value")]
224  public string Value { get; set; }
225  }
226 
227  /// <summary>
228  /// Response from reading a project by id.
229  /// </summary>
230  public class Project : RestResponse
231  {
232  /// <summary>
233  /// Project id
234  /// </summary>
235  [JsonProperty(PropertyName = "projectId")]
236  public int ProjectId { get; set; }
237 
238  /// <summary>
239  /// Name of the project
240  /// </summary>
241  [JsonProperty(PropertyName = "name")]
242  public string Name { get; set; }
243 
244  /// <summary>
245  /// Date the project was created
246  /// </summary>
247  [JsonProperty(PropertyName = "created")]
248  public DateTime Created { get; set; }
249 
250  /// <summary>
251  /// Modified date for the project
252  /// </summary>
253  [JsonProperty(PropertyName = "modified")]
254  public DateTime Modified { get; set; }
255 
256  /// <summary>
257  /// Programming language of the project
258  /// </summary>
259  [JsonProperty(PropertyName = "language")]
260  public Language Language { get; set; }
261 
262  /// <summary>
263  /// The projects owner id
264  /// </summary>
265  [JsonProperty(PropertyName = "ownerId")]
266  public int OwnerId { get; set; }
267 
268  /// <summary>
269  /// The organization ID
270  /// </summary>
271  [JsonProperty(PropertyName = "organizationId")]
272  public string OrganizationId { get; set; }
273 
274  /// <summary>
275  /// List of collaborators
276  /// </summary>
277  [JsonProperty(PropertyName = "collaborators")]
278  public List<Collaborator> Collaborators { get; set; }
279 
280  /// <summary>
281  /// The version of LEAN this project is running on
282  /// </summary>
283  [JsonProperty(PropertyName = "leanVersionId")]
284  public int LeanVersionId { get; set; }
285 
286  /// <summary>
287  /// Indicate if the project is pinned to the master branch of LEAN
288  /// </summary>
289  [JsonProperty(PropertyName = "leanPinnedToMaster")]
290  public bool LeanPinnedToMaster { get; set; }
291 
292  /// <summary>
293  /// Indicate if you are the owner of the project
294  /// </summary>
295  [JsonProperty(PropertyName = "owner")]
296  public bool Owner { get; set; }
297 
298  /// <summary>
299  /// The project description
300  /// </summary>
301  [JsonProperty(PropertyName = "description")]
302  public string Description { get; set; }
303 
304  /// <summary>
305  /// Channel id
306  /// </summary>
307  [JsonProperty(PropertyName = "channelId")]
308  public string ChannelId { get; set; }
309 
310  /// <summary>
311  /// Optimization parameters
312  /// </summary>
313  [JsonProperty(PropertyName = "parameters")]
314  public List<Parameter> Parameters { get; set; }
315 
316  /// <summary>
317  /// The library projects
318  /// </summary>
319  [JsonProperty(PropertyName = "libraries")]
320  public List<Library> Libraries { get; set; }
321 
322  /// <summary>
323  /// Configuration of the backtest view grid
324  /// </summary>
325  [JsonProperty(PropertyName = "grid" )]
326  public Grid Grid { get; set; }
327 
328  /// <summary>
329  /// Configuration of the live view grid
330  /// </summary>
331  [JsonProperty(PropertyName = "liveGrid")]
332  public Grid LiveGrid { get; set; }
333 
334  /// <summary>
335  /// The equity value of the last paper trading instance
336  /// </summary>
337  [JsonProperty(PropertyName = "paperEquity")]
338  public decimal? PaperEquity { get; set; }
339 
340  /// <summary>
341  /// The last live deployment active time
342  /// </summary>
343  [JsonProperty(PropertyName = "lastLiveDeployment")]
344  public DateTime? LastLiveDeployment { get; set; }
345 
346  /// <summary>
347  /// The last live wizard content used
348  /// </summary>
349  [JsonProperty(PropertyName = "liveForm")]
350  public object LiveForm { get; set; }
351 
352  /// <summary>
353  /// Indicates if the project is encrypted
354  /// </summary>
355  [JsonProperty(PropertyName = "encrypted")]
356  public bool? Encrypted { get; set; }
357 
358  /// <summary>
359  /// Indicates if the project is running or not
360  /// </summary>
361  [JsonProperty(PropertyName = "codeRunning")]
362  public bool CodeRunning { get; set; }
363 
364  /// <summary>
365  /// LEAN environment of the project running on
366  /// </summary>
367  [JsonProperty(PropertyName = "leanEnvironment")]
368  public int LeanEnvironment { get; set; }
369 
370  /// <summary>
371  /// Text file with at least 32 characters to be used to encrypt the project
372  /// </summary>
373  [JsonProperty(PropertyName = "encryptionKey")]
374  public EncryptionKey EncryptionKey { get; set; }
375  }
376 
377  /// <summary>
378  /// API response for version
379  /// </summary>
380  public class Version
381  {
382  /// <summary>
383  /// ID of the LEAN version
384  /// </summary>
385  [JsonProperty(PropertyName = "id")]
386  public int Id { get; set; }
387 
388  /// <summary>
389  /// Date when this version was created
390  /// </summary>
391  [JsonProperty(PropertyName = "created")]
392  public DateTime? Created { get; set; }
393 
394  /// <summary>
395  /// Description of the LEAN version
396  /// </summary>
397  [JsonProperty(PropertyName = "description")]
398  public string Description { get; set; }
399 
400  /// <summary>
401  /// Commit Hash in the LEAN repository
402  /// </summary>
403  [JsonProperty(PropertyName = "leanHash")]
404  public string LeanHash { get; set; }
405 
406  /// <summary>
407  /// Commit Hash in the LEAN Cloud repository
408  /// </summary>
409  [JsonProperty(PropertyName = "leanCloudHash")]
410  public string LeanCloudHash { get; set; }
411 
412  /// <summary>
413  /// Name of the branch where the commit is
414  /// </summary>
415  [JsonProperty(PropertyName = "name")]
416  public string Name { get; set; }
417 
418  /// <summary>
419  /// Reference to the branch where the commit is
420  /// </summary>
421  [JsonProperty(PropertyName = "ref")]
422  public string Ref { get; set; }
423 
424  /// <summary>
425  /// Indicates if the version is available for the public (1) or not (0)
426  /// </summary>
427  [JsonProperty(PropertyName = "public")]
428  public bool Public { get; set; }
429  }
430 
431  /// <summary>
432  /// Read versions response
433  /// </summary>
435  {
436  /// <summary>
437  /// List of LEAN versions
438  /// </summary>
439  [JsonProperty(PropertyName = "versions")]
440  public List<Version> Versions { get; set; }
441  }
442 
443  /// <summary>
444  /// Project list response
445  /// </summary>
447  {
448  /// <summary>
449  /// List of projects for the authenticated user
450  /// </summary>
451  [JsonProperty(PropertyName = "projects")]
452  public List<Project> Projects { get; set; }
453  }
454 }