Lean  $LEAN_TAG$
Controls.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 
17 using System.IO;
18 using Newtonsoft.Json;
20 
21 namespace QuantConnect.Packets
22 {
23  /// <summary>
24  /// Specifies values used to control algorithm limits
25  /// </summary>
26  public class Controls
27  {
28  /// <summary>
29  /// The maximum runtime in minutes
30  /// </summary>
31  [JsonProperty(PropertyName = "iMaximumRuntimeMinutes")]
33 
34  /// <summary>
35  /// The maximum number of minute symbols
36  /// </summary>
37  [JsonProperty(PropertyName = "iMinuteLimit")]
38  public int MinuteLimit;
39 
40  /// <summary>
41  /// The maximum number of second symbols
42  /// </summary>
43  [JsonProperty(PropertyName = "iSecondLimit")]
44  public int SecondLimit;
45 
46  /// <summary>
47  /// The maximum number of tick symbol
48  /// </summary>
49  [JsonProperty(PropertyName = "iTickLimit")]
50  public int TickLimit;
51 
52  /// <summary>
53  /// Ram allocation for this algorithm in MB
54  /// </summary>
55  [JsonProperty(PropertyName = "iMaxRamAllocation")]
56  public int RamAllocation;
57 
58  /// <summary>
59  /// CPU allocation for this algorithm
60  /// </summary>
61  [JsonProperty(PropertyName = "dMaxCpuAllocation")]
62  public decimal CpuAllocation;
63 
64  /// <summary>
65  /// The user live log limit
66  /// </summary>
67  [JsonProperty(PropertyName = "iLiveLogLimit")]
68  public int LiveLogLimit;
69 
70  /// <summary>
71  /// The user backtesting log limit
72  /// </summary>
73  [JsonProperty(PropertyName = "iBacktestLogLimit")]
74  public int BacktestLogLimit;
75 
76  /// <summary>
77  /// The daily log limit of a user
78  /// </summary>
79  [JsonProperty(PropertyName = "iDailyLogLimit")]
80  public int DailyLogLimit;
81 
82  /// <summary>
83  /// The remaining log allowance for a user
84  /// </summary>
85  [JsonProperty(PropertyName = "iRemainingLogAllowance")]
87 
88  /// <summary>
89  /// Maximimum number of insights we'll store and score in a single backtest
90  /// </summary>
91  [JsonProperty(PropertyName = "iBacktestingMaxInsights")]
93 
94  /// <summary>
95  /// Maximimum number of orders we'll allow in a backtest.
96  /// </summary>
97  [JsonProperty(PropertyName = "iBacktestingMaxOrders")]
98  public int BacktestingMaxOrders { get; set; }
99 
100  /// <summary>
101  /// Limits the amount of data points per chart series. Applies only for backtesting
102  /// </summary>
103  [JsonProperty(PropertyName = "iMaximumDataPointsPerChartSeries")]
105 
106  /// <summary>
107  /// Limits the amount of chart series. Applies only for backtesting
108  /// </summary>
109  [JsonProperty(PropertyName = "iMaximumChartSeries")]
110  public int MaximumChartSeries;
111 
112  /// <summary>
113  /// The amount seconds used for timeout limits
114  /// </summary>
115  [JsonProperty(PropertyName = "iSecondTimeOut")]
116  public int SecondTimeOut;
117 
118  /// <summary>
119  /// Sets parameters used for determining the behavior of the leaky bucket algorithm that
120  /// controls how much time is available for an algorithm to use the training feature.
121  /// </summary>
122  [JsonProperty(PropertyName = "oTrainingLimits")]
124 
125  /// <summary>
126  /// Limits the total size of storage used by <see cref="IObjectStore"/>
127  /// </summary>
128  [JsonProperty(PropertyName = "storageLimit")]
129  public long StorageLimit;
130 
131  /// <summary>
132  /// Limits the number of files to be held under the <see cref="IObjectStore"/>
133  /// </summary>
134  [JsonProperty(PropertyName = "storageFileCount")]
135  public int StorageFileCount;
136 
137  /// <summary>
138  /// Holds the permissions for the object store
139  /// </summary>
140  [JsonProperty(PropertyName = "storagePermissions")]
141  public FileAccess StoragePermissions;
142 
143  /// <summary>
144  /// The interval over which the <see cref="IObjectStore"/> will persistence the contents of
145  /// the object store
146  /// </summary>
147  [JsonProperty(PropertyName = "persistenceIntervalSeconds")]
149 
150  /// <summary>
151  /// The cost associated with running this job
152  /// </summary>
153  [JsonProperty(PropertyName = "dCreditCost")]
154  public decimal CreditCost;
155 
156  /// <summary>
157  /// Initializes a new default instance of the <see cref="Controls"/> class
158  /// </summary>
159  public Controls()
160  {
161  MinuteLimit = 500;
162  SecondLimit = 100;
163  TickLimit = 30;
164  RamAllocation = 1024;
165  BacktestLogLimit = 10000;
166  BacktestingMaxOrders = int.MaxValue;
167  DailyLogLimit = 3000000;
168  RemainingLogAllowance = 10000;
169  MaximumRuntimeMinutes = 60 * 24 * 100; // 100 days default
170  BacktestingMaxInsights = 10000;
171  MaximumChartSeries = 10;
173  SecondTimeOut = 300;
174  StorageLimit = 10737418240;
175  StorageFileCount = 10000;
177  StoragePermissions = FileAccess.ReadWrite;
178 
179  // initialize to default leaky bucket values in case they're not specified
181  }
182  }
183 }