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