Lean  $LEAN_TAG$
CrossZeroFirstOrderRequest.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 QuantConnect.Orders;
17 using System;
18 
20 {
21  /// <summary>
22  /// Represents a first request to cross zero order.
23  /// </summary>
25  {
26  /// <summary>
27  /// Gets the original lean order.
28  /// </summary>
29  public Order LeanOrder { get; }
30 
31  /// <summary>
32  /// Gets the type of the order.
33  /// </summary>
34  public OrderType OrderType { get; }
35 
36  /// <summary>
37  /// Gets the quantity of the order.
38  /// </summary>
39  public decimal OrderQuantity { get; }
40 
41  /// <summary>
42  /// Gets the absolute quantity of the order.
43  /// </summary>
44  public decimal AbsoluteOrderQuantity => Math.Abs(OrderQuantity);
45 
46  /// <summary>
47  /// Gets the current holding quantity of the order's symbol.
48  /// </summary>
49  public decimal OrderQuantityHolding { get; }
50 
51  /// <summary>
52  /// Gets the position of the order.
53  /// </summary>
54  /// <value>
55  /// The position of the order, which depends on the <see cref="OrderQuantityHolding"/>.
56  /// </value>
57  public OrderPosition OrderPosition { get; }
58 
59  /// <summary>
60  /// Initializes a new instance of the <see cref="CrossZeroFirstOrderRequest"/> struct.
61  /// </summary>
62  /// <param name="leanOrder">The lean order.</param>
63  /// <param name="orderType">The type of the order.</param>
64  /// <param name="orderQuantity">The quantity of the order.</param>
65  /// <param name="orderQuantityHolding">The current holding quantity of the order's symbol.</param>
66  /// <param name="orderPosition">The position of the order, which depends on the <paramref name="orderQuantityHolding"/>.</param>
67  public CrossZeroFirstOrderRequest(Order leanOrder, OrderType orderType, decimal orderQuantity, decimal orderQuantityHolding, OrderPosition orderPosition)
68  {
69  LeanOrder = leanOrder;
70  OrderType = orderType;
71  OrderQuantity = orderQuantity;
72  OrderPosition = orderPosition;
73  OrderQuantityHolding = orderQuantityHolding;
74  }
75  }
76 }