Lean  $LEAN_TAG$
GetMaximumLotsResult.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 
17 {
18  /// <summary>
19  /// Result type for <see cref="IPositionGroupBuyingPowerModel.GetMaximumLotsForDeltaBuyingPower"/>
20  /// and <see cref="IPositionGroupBuyingPowerModel.GetMaximumLotsForTargetBuyingPower"/>
21  /// </summary>
22  public class GetMaximumLotsResult
23  {
24  /// <summary>
25  /// Returns the maximum number of lots of the position group that can be
26  /// ordered. This is a whole number and is the <see cref="IPositionGroup.Quantity"/>
27  /// </summary>
28  public decimal NumberOfLots { get; }
29 
30  /// <summary>
31  /// Returns the reason for which the maximum order quantity is zero
32  /// </summary>
33  public string Reason { get; }
34 
35  /// <summary>
36  /// Returns true if the zero order quantity is an error condition and will be shown to the user.
37  /// </summary>
38  public bool IsError { get; }
39 
40  /// <summary>
41  /// Initializes a new instance of the <see cref="GetMaximumOrderQuantityResult"/> class
42  /// </summary>
43  /// <param name="numberOfLots">Returns the maximum number of lots of the position group that can be ordered</param>
44  /// <param name="reason">The reason for which the maximum order quantity is zero</param>
45  public GetMaximumLotsResult(decimal numberOfLots, string reason = null)
46  {
47  NumberOfLots = numberOfLots;
48  Reason = reason ?? string.Empty;
49  IsError = !string.IsNullOrEmpty(Reason);
50  }
51 
52  /// <summary>
53  /// Initializes a new instance of the <see cref="GetMaximumOrderQuantityResult"/> class
54  /// </summary>
55  /// <param name="numberOfLots">Returns the maximum number of lots of the position group that can be ordered</param>
56  /// <param name="reason">The reason for which the maximum order quantity is zero</param>
57  /// <param name="isError">True if the zero order quantity is an error condition</param>
58  public GetMaximumLotsResult(decimal numberOfLots, string reason, bool isError = true)
59  {
60  IsError = isError;
61  NumberOfLots = numberOfLots;
62  Reason = reason ?? string.Empty;
63  }
64  }
65 }