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