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>
32 
33  /// <summary>
34  /// The maximum number of minute symbols
35  /// </summary>
36  public int MinuteLimit;
37 
38  /// <summary>
39  /// The maximum number of second symbols
40  /// </summary>
41  public int SecondLimit;
42 
43  /// <summary>
44  /// The maximum number of tick symbol
45  /// </summary>
46  public int TickLimit;
47 
48  /// <summary>
49  /// Ram allocation for this algorithm in MB
50  /// </summary>
51  public int RamAllocation;
52 
53  /// <summary>
54  /// CPU allocation for this algorithm
55  /// </summary>
56  public decimal CpuAllocation;
57 
58  /// <summary>
59  /// The user live log limit
60  /// </summary>
61  public int LiveLogLimit;
62 
63  /// <summary>
64  /// The user backtesting log limit
65  /// </summary>
66  public int BacktestLogLimit;
67 
68  /// <summary>
69  /// The daily log limit of a user
70  /// </summary>
71  public int DailyLogLimit;
72 
73  /// <summary>
74  /// The remaining log allowance for a user
75  /// </summary>
77 
78  /// <summary>
79  /// Maximimum number of insights we'll store and score in a single backtest
80  /// </summary>
82 
83  /// <summary>
84  /// Maximimum number of orders we'll allow in a backtest.
85  /// </summary>
86  public int BacktestingMaxOrders { get; set; }
87 
88  /// <summary>
89  /// Limits the amount of data points per chart series. Applies only for backtesting
90  /// </summary>
92 
93  /// <summary>
94  /// Limits the amount of chart series. Applies only for backtesting
95  /// </summary>
96  public int MaximumChartSeries;
97 
98  /// <summary>
99  /// The amount seconds used for timeout limits
100  /// </summary>
101  public int SecondTimeOut;
102 
103  /// <summary>
104  /// Sets parameters used for determining the behavior of the leaky bucket algorithm that
105  /// controls how much time is available for an algorithm to use the training feature.
106  /// </summary>
108 
109  /// <summary>
110  /// Limits the total size of storage used by <see cref="IObjectStore"/>
111  /// </summary>
112  public long StorageLimit;
113 
114  /// <summary>
115  /// Limits the number of files to be held under the <see cref="IObjectStore"/>
116  /// </summary>
117  public int StorageFileCount;
118 
119  /// <summary>
120  /// Holds the permissions for the object store
121  /// </summary>
122  public FileAccess StoragePermissions;
123 
124  /// <summary>
125  /// The interval over which the <see cref="IObjectStore"/> will persistence the contents of
126  /// the object store
127  /// </summary>
129 
130  /// <summary>
131  /// The cost associated with running this job
132  /// </summary>
133  public decimal CreditCost;
134 
135  /// <summary>
136  /// Initializes a new default instance of the <see cref="Controls"/> class
137  /// </summary>
138  public Controls()
139  {
140  MinuteLimit = 500;
141  SecondLimit = 100;
142  TickLimit = 30;
143  RamAllocation = 1024;
144  BacktestLogLimit = 10000;
145  BacktestingMaxOrders = int.MaxValue;
146  DailyLogLimit = 3000000;
147  RemainingLogAllowance = 10000;
148  MaximumRuntimeMinutes = 60 * 24 * 100; // 100 days default
149  BacktestingMaxInsights = 10000;
150  MaximumChartSeries = 10;
152  SecondTimeOut = 300;
153  StorageLimit = 10737418240;
154  StorageFileCount = 10000;
156  StoragePermissions = FileAccess.ReadWrite;
157 
158  // initialize to default leaky bucket values in case they're not specified
160  }
161  }
162 }