Lean  $LEAN_TAG$
GetMaximumOrderQuantityResult.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  /// Contains the information returned by <see cref="IBuyingPowerModel.GetMaximumOrderQuantityForTargetBuyingPower"/>
20  /// and <see cref="IBuyingPowerModel.GetMaximumOrderQuantityForDeltaBuyingPower"/>
21  /// </summary>
23  {
24  /// <summary>
25  /// Returns the maximum quantity for the order
26  /// </summary>
27  public decimal Quantity { get; }
28 
29  /// <summary>
30  /// Returns the reason for which the maximum order quantity is zero
31  /// </summary>
32  public string Reason { get; }
33 
34  /// <summary>
35  /// Returns true if the zero order quantity is an error condition and will be shown to the user.
36  /// </summary>
37  public bool IsError { get; }
38 
39  /// <summary>
40  /// Initializes a new instance of the <see cref="GetMaximumOrderQuantityResult"/> class
41  /// </summary>
42  /// <param name="quantity">Returns the maximum quantity for the order</param>
43  /// <param name="reason">The reason for which the maximum order quantity is zero</param>
44  public GetMaximumOrderQuantityResult(decimal quantity, string reason = null)
45  {
46  Quantity = quantity;
47  Reason = reason ?? string.Empty;
48  IsError = !string.IsNullOrEmpty(Reason);
49  }
50 
51  /// <summary>
52  /// Initializes a new instance of the <see cref="GetMaximumOrderQuantityResult"/> class
53  /// </summary>
54  /// <param name="quantity">Returns the maximum quantity for the order</param>
55  /// <param name="reason">The reason for which the maximum order quantity is zero</param>
56  /// <param name="isError">True if the zero order quantity is an error condition</param>
57  public GetMaximumOrderQuantityResult(decimal quantity, string reason, bool isError = true)
58  {
59  Quantity = quantity;
60  Reason = reason ?? string.Empty;
61  IsError = isError;
62  }
63  }
64 }