Lean  $LEAN_TAG$
Organization.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 System;
17 using System.Collections.Generic;
18 using Newtonsoft.Json;
20 
21 // Collection of response objects for QuantConnect Organization/ endpoints
22 namespace QuantConnect.Api
23 {
24  /// <summary>
25  /// Response wrapper for Organizations/Read
26  /// </summary>
28  {
29  /// <summary>
30  /// Organization read from the response
31  /// </summary>
32  public Organization Organization { get; set; }
33  }
34 
35  /// <summary>
36  /// Object representation of Organization from QuantConnect Api
37  /// </summary>
38  public class Organization
39  {
40  /// <summary>
41  /// Data Agreement information
42  /// </summary>
43  [JsonProperty(PropertyName = "data")]
44  public DataAgreement DataAgreement { get; set; }
45 
46  /// <summary>
47  /// Organization Product Subscriptions
48  /// </summary>
49  public List<Product> Products { get; set; }
50 
51  /// <summary>
52  /// Organization Credit Balance and Transactions
53  /// </summary>
54  public Credit Credit { get; set; }
55  }
56 
57  /// <summary>
58  /// Organization Data Agreement
59  /// </summary>
60  public class DataAgreement
61  {
62  /// <summary>
63  /// Epoch time the Data Agreement was Signed
64  /// </summary>
65  [JsonProperty(PropertyName = "signedTime")]
66  public long? EpochSignedTime { get; set; }
67 
68  /// <summary>
69  /// DateTime the agreement was signed.
70  /// Uses EpochSignedTime converted to a standard datetime.
71  /// </summary>
72  public DateTime? SignedTime => EpochSignedTime.HasValue ? DateTimeOffset.FromUnixTimeSeconds(EpochSignedTime.Value).DateTime : null;
73 
74  /// <summary>
75  /// True/False if it is currently signed
76  /// </summary>
77  [JsonProperty(PropertyName = "current")]
78  public bool Signed { get; set; }
79  }
80 
81  /// <summary>
82  /// Organization Credit Object
83  /// </summary>
84  public class Credit
85  {
86  /// <summary>
87  /// QCC Current Balance
88  /// </summary>
89  public decimal Balance { get; set; }
90  }
91 
92  /// <summary>
93  /// QuantConnect Products
94  /// </summary>
95  [JsonConverter(typeof(ProductJsonConverter))]
96  public class Product
97  {
98  /// <summary>
99  /// Product Type
100  /// </summary>
101  public ProductType Type { get; set; }
102 
103  /// <summary>
104  /// Collection of item subscriptions
105  /// Nodes/Data/Seats/etc
106  /// </summary>
107  public List<ProductItem> Items { get; set; }
108  }
109 
110  /// <summary>
111  /// QuantConnect ProductItem
112  /// </summary>
113  public class ProductItem
114  {
115  /// <summary>
116  /// ID for this product
117  /// </summary>
118  [JsonProperty(PropertyName = "productId")]
119  public int Id { get; set; }
120  }
121 
122  /// <summary>
123  /// Product types offered by QuantConnect
124  /// Used by Product class
125  /// </summary>
126  public enum ProductType
127  {
128  /// <summary>
129  /// Professional Seats Subscriptions
130  /// </summary>
132 
133  /// <summary>
134  /// Backtest Nodes Subscriptions
135  /// </summary>
136  BacktestNode,
137 
138  /// <summary>
139  /// Research Nodes Subscriptions
140  /// </summary>
141  ResearchNode,
142 
143  /// <summary>
144  /// Live Trading Nodes Subscriptions
145  /// </summary>
146  LiveNode,
147 
148  /// <summary>
149  /// Support Subscriptions
150  /// </summary>
151  Support,
152 
153  /// <summary>
154  /// Data Subscriptions
155  /// </summary>
156  Data,
157 
158  /// <summary>
159  /// Modules Subscriptions
160  /// </summary>
161  Modules
162  }
163 }