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  /// <summary>
155  /// Optionally related definition
156  /// </summary>
157  [JsonProperty(PropertyName = "definition")]
158  public List<string> Definition { get; set; }
159  }
160 
161  /// <summary>
162  /// The grid arrangement of charts
163  /// </summary>
164  public class Grid
165  {
166  /// <summary>
167  /// List of chart in the xs (Extra small) position
168  /// </summary>
169  [JsonProperty(PropertyName = "xs")]
170  public List<GridChart> Xs { get; set; }
171 
172  /// <summary>
173  /// List of chart in the sm (Small) position
174  /// </summary>
175  [JsonProperty(PropertyName = "sm")]
176  public List<GridChart> Sm { get; set; }
177 
178  /// <summary>
179  /// List of chart in the md (Medium) position
180  /// </summary>
181  [JsonProperty(PropertyName = "md")]
182  public List<GridChart> Md { get; set; }
183 
184  /// <summary>
185  /// List of chart in the lg (Large) position
186  /// </summary>
187  [JsonProperty(PropertyName = "lg")]
188  public List<GridChart> Lg { get; set; }
189 
190  /// <summary>
191  /// List of chart in the xl (Extra large) position
192  /// </summary>
193  [JsonProperty(PropertyName = "xl")]
194  public List<GridChart> Xl { get; set; }
195  }
196 
197  /// <summary>
198  /// Encryption key details
199  /// </summary>
200  public class EncryptionKey
201  {
202  /// <summary>
203  /// Encryption key id
204  /// </summary>
205  [JsonProperty(PropertyName = "id")]
206  public string Id { get; set; }
207 
208  /// <summary>
209  /// Name of the encryption key
210  /// </summary>
211  [JsonProperty(PropertyName = "name")]
212  public string Name { get; set; }
213  }
214 
215  /// <summary>
216  /// Parameter set
217  /// </summary>
218  public class Parameter
219  {
220  /// <summary>
221  /// Name of parameter
222  /// </summary>
223  [JsonProperty(PropertyName = "name")]
224  public string Name { get; set; }
225 
226  /// <summary>
227  /// Value of parameter
228  /// </summary>
229  [JsonProperty(PropertyName = "value")]
230  public string Value { get; set; }
231  }
232 
233  /// <summary>
234  /// Response from reading a project by id.
235  /// </summary>
236  public class Project : RestResponse
237  {
238  /// <summary>
239  /// Project id
240  /// </summary>
241  [JsonProperty(PropertyName = "projectId")]
242  public int ProjectId { get; set; }
243 
244  /// <summary>
245  /// Name of the project
246  /// </summary>
247  [JsonProperty(PropertyName = "name")]
248  public string Name { get; set; }
249 
250  /// <summary>
251  /// Date the project was created
252  /// </summary>
253  [JsonProperty(PropertyName = "created")]
254  public DateTime Created { get; set; }
255 
256  /// <summary>
257  /// Modified date for the project
258  /// </summary>
259  [JsonProperty(PropertyName = "modified")]
260  public DateTime Modified { get; set; }
261 
262  /// <summary>
263  /// Programming language of the project
264  /// </summary>
265  [JsonProperty(PropertyName = "language")]
266  public Language Language { get; set; }
267 
268  /// <summary>
269  /// The projects owner id
270  /// </summary>
271  [JsonProperty(PropertyName = "ownerId")]
272  public int OwnerId { get; set; }
273 
274  /// <summary>
275  /// The organization ID
276  /// </summary>
277  [JsonProperty(PropertyName = "organizationId")]
278  public string OrganizationId { get; set; }
279 
280  /// <summary>
281  /// List of collaborators
282  /// </summary>
283  [JsonProperty(PropertyName = "collaborators")]
284  public List<Collaborator> Collaborators { get; set; }
285 
286  /// <summary>
287  /// The version of LEAN this project is running on
288  /// </summary>
289  [JsonProperty(PropertyName = "leanVersionId")]
290  public int LeanVersionId { get; set; }
291 
292  /// <summary>
293  /// Indicate if the project is pinned to the master branch of LEAN
294  /// </summary>
295  [JsonProperty(PropertyName = "leanPinnedToMaster")]
296  public bool LeanPinnedToMaster { get; set; }
297 
298  /// <summary>
299  /// Indicate if you are the owner of the project
300  /// </summary>
301  [JsonProperty(PropertyName = "owner")]
302  public bool Owner { get; set; }
303 
304  /// <summary>
305  /// The project description
306  /// </summary>
307  [JsonProperty(PropertyName = "description")]
308  public string Description { get; set; }
309 
310  /// <summary>
311  /// Channel id
312  /// </summary>
313  [JsonProperty(PropertyName = "channelId")]
314  public string ChannelId { get; set; }
315 
316  /// <summary>
317  /// Optimization parameters
318  /// </summary>
319  [JsonProperty(PropertyName = "parameters")]
320  public List<Parameter> Parameters { get; set; }
321 
322  /// <summary>
323  /// The library projects
324  /// </summary>
325  [JsonProperty(PropertyName = "libraries")]
326  public List<Library> Libraries { get; set; }
327 
328  /// <summary>
329  /// Configuration of the backtest view grid
330  /// </summary>
331  [JsonProperty(PropertyName = "grid" )]
332  public Grid Grid { get; set; }
333 
334  /// <summary>
335  /// Configuration of the live view grid
336  /// </summary>
337  [JsonProperty(PropertyName = "liveGrid")]
338  public Grid LiveGrid { get; set; }
339 
340  /// <summary>
341  /// The equity value of the last paper trading instance
342  /// </summary>
343  [JsonProperty(PropertyName = "paperEquity")]
344  public decimal? PaperEquity { get; set; }
345 
346  /// <summary>
347  /// The last live deployment active time
348  /// </summary>
349  [JsonProperty(PropertyName = "lastLiveDeployment")]
350  public DateTime? LastLiveDeployment { get; set; }
351 
352  /// <summary>
353  /// The last live wizard content used
354  /// </summary>
355  [JsonProperty(PropertyName = "liveForm")]
356  public object LiveForm { get; set; }
357 
358  /// <summary>
359  /// Indicates if the project is encrypted
360  /// </summary>
361  [JsonProperty(PropertyName = "encrypted")]
362  public bool? Encrypted { get; set; }
363 
364  /// <summary>
365  /// Indicates if the project is running or not
366  /// </summary>
367  [JsonProperty(PropertyName = "codeRunning")]
368  public bool CodeRunning { get; set; }
369 
370  /// <summary>
371  /// LEAN environment of the project running on
372  /// </summary>
373  [JsonProperty(PropertyName = "leanEnvironment")]
374  public int LeanEnvironment { get; set; }
375 
376  /// <summary>
377  /// Text file with at least 32 characters to be used to encrypt the project
378  /// </summary>
379  [JsonProperty(PropertyName = "encryptionKey")]
380  public EncryptionKey EncryptionKey { get; set; }
381  }
382 
383  /// <summary>
384  /// API response for version
385  /// </summary>
386  public class Version
387  {
388  /// <summary>
389  /// ID of the LEAN version
390  /// </summary>
391  [JsonProperty(PropertyName = "id")]
392  public int Id { get; set; }
393 
394  /// <summary>
395  /// Date when this version was created
396  /// </summary>
397  [JsonProperty(PropertyName = "created")]
398  public DateTime? Created { get; set; }
399 
400  /// <summary>
401  /// Description of the LEAN version
402  /// </summary>
403  [JsonProperty(PropertyName = "description")]
404  public string Description { get; set; }
405 
406  /// <summary>
407  /// Commit Hash in the LEAN repository
408  /// </summary>
409  [JsonProperty(PropertyName = "leanHash")]
410  public string LeanHash { get; set; }
411 
412  /// <summary>
413  /// Commit Hash in the LEAN Cloud repository
414  /// </summary>
415  [JsonProperty(PropertyName = "leanCloudHash")]
416  public string LeanCloudHash { get; set; }
417 
418  /// <summary>
419  /// Name of the branch where the commit is
420  /// </summary>
421  [JsonProperty(PropertyName = "name")]
422  public string Name { get; set; }
423 
424  /// <summary>
425  /// Reference to the branch where the commit is
426  /// </summary>
427  [JsonProperty(PropertyName = "ref")]
428  public string Ref { get; set; }
429 
430  /// <summary>
431  /// Indicates if the version is available for the public (1) or not (0)
432  /// </summary>
433  [JsonProperty(PropertyName = "public")]
434  public bool Public { get; set; }
435  }
436 
437  /// <summary>
438  /// Read versions response
439  /// </summary>
441  {
442  /// <summary>
443  /// List of LEAN versions
444  /// </summary>
445  [JsonProperty(PropertyName = "versions")]
446  public List<Version> Versions { get; set; }
447  }
448 
449  /// <summary>
450  /// Project list response
451  /// </summary>
453  {
454  /// <summary>
455  /// List of projects for the authenticated user
456  /// </summary>
457  [JsonProperty(PropertyName = "projects")]
458  public List<Project> Projects { get; set; }
459  }
460 }