Lean  $LEAN_TAG$
IAlgorithmSettings.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;
18 
20 {
21  /// <summary>
22  /// User settings for the algorithm which can be changed in the <see cref="IAlgorithm.Initialize"/> method
23  /// </summary>
24  public interface IAlgorithmSettings
25  {
26  /// <summary>
27  /// Gets whether or not WarmUpIndicator is allowed to warm up indicators
28  /// </summary>
29  bool AutomaticIndicatorWarmUp { get; set; }
30 
31  /// <summary>
32  /// True if should rebalance portfolio on security changes. True by default
33  /// </summary>
35 
36  /// <summary>
37  /// True if should rebalance portfolio on new insights or expiration of insights. True by default
38  /// </summary>
40 
41  /// <summary>
42  /// The absolute maximum valid total portfolio value target percentage
43  /// </summary>
44  /// <remarks>This setting is currently being used to filter out undesired target percent values,
45  /// caused by the IPortfolioConstructionModel implementation being used.
46  /// For example rounding errors, math operations</remarks>
48 
49  /// <summary>
50  /// The absolute minimum valid total portfolio value target percentage
51  /// </summary>
52  /// <remarks>This setting is currently being used to filter out undesired target percent values,
53  /// caused by the IPortfolioConstructionModel implementation being used.
54  /// For example rounding errors, math operations</remarks>
56 
57  /// <summary>
58  /// Configurable minimum order margin portfolio percentage to ignore bad orders, or orders with unrealistic sizes
59  /// </summary>
60  /// <remarks>Default minimum order size is $0 value</remarks>
62 
63  /// <summary>
64  /// Gets/sets the SetHoldings buffers value.
65  /// The buffer is used for orders not to be rejected due to volatility when using SetHoldings and CalculateOrderQuantity
66  /// </summary>
67  decimal? FreePortfolioValue { get; set; }
68 
69  /// <summary>
70  /// Gets/sets the SetHoldings buffers value percentage.
71  /// This percentage will be used to set the <see cref="FreePortfolioValue"/>
72  /// based on the <see cref="SecurityPortfolioManager.TotalPortfolioValue"/>
73  /// </summary>
74  decimal FreePortfolioValuePercentage { get; set; }
75 
76  /// <summary>
77  /// Gets/sets if Liquidate() is enabled
78  /// </summary>
79  bool LiquidateEnabled { get; set; }
80 
81  /// <summary>
82  /// True if daily strict end times are enabled
83  /// </summary>
84  bool DailyPreciseEndTime { get; set; }
85 
86  /// <summary>
87  /// Gets/sets the maximum number of concurrent market data subscriptions available
88  /// </summary>
89  /// <remarks>
90  /// All securities added with <see cref="IAlgorithm.AddSecurity"/> are counted as one,
91  /// with the exception of options and futures where every single contract in a chain counts as one.
92  /// </remarks>
93  [Obsolete("This property is deprecated. Please observe data subscription limits set by your brokerage to avoid runtime errors.")]
94  int DataSubscriptionLimit { get; set; }
95 
96  /// <summary>
97  /// Gets the minimum time span elapsed to consider a market fill price as stale (defaults to one hour)
98  /// </summary>
99  TimeSpan StalePriceTimeSpan { get; set; }
100 
101  /// <summary>
102  /// The warmup resolution to use if any
103  /// </summary>
104  /// <remarks>This allows improving the warmup speed by setting it to a lower resolution than the one added in the algorithm</remarks>
106 
107  /// <summary>
108  /// Gets or sets the number of trading days per year for this Algorithm's portfolio statistics.
109  /// </summary>
110  /// <remarks>
111  /// This property affects the calculation of various portfolio statistics, including:
112  /// - <see cref="Statistics.PortfolioStatistics.AnnualVariance"/>
113  /// - <seealso cref="Statistics.PortfolioStatistics.AnnualStandardDeviation"/>
114  /// - <seealso cref="Statistics.PortfolioStatistics.SharpeRatio"/>
115  /// - <seealso cref="Statistics.PortfolioStatistics.SortinoRatio"/>
116  /// - <seealso cref="Statistics.PortfolioStatistics.TrackingError"/>
117  /// - <seealso cref="Statistics.PortfolioStatistics.InformationRatio"/>.
118  ///
119  /// The default values are:
120  /// - Cryptocurrency Exchanges: 365 days
121  /// - Traditional Stock Exchanges: 252 days
122  ///
123  /// Users can also set a custom value for this property.
124  /// </remarks>
125  int? TradingDaysPerYear { get; set; }
126 
127  /// <summary>
128  /// Gets the time span used to refresh the market hours and symbol properties databases
129  /// </summary>
130  TimeSpan DatabasesRefreshPeriod { get; set; }
131  }
132 }