Lean  $LEAN_TAG$
OrderTypes.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 namespace QuantConnect.Orders
17 {
18  /// <summary>
19  /// Type of the order: market, limit or stop
20  /// </summary>
21  public enum OrderType
22  {
23  /// <summary>
24  /// Market Order Type (0)
25  /// </summary>
26  Market,
27 
28  /// <summary>
29  /// Limit Order Type (1)
30  /// </summary>
31  Limit,
32 
33  /// <summary>
34  /// Stop Market Order Type - Fill at market price when break target price (2)
35  /// </summary>
36  StopMarket,
37 
38  /// <summary>
39  /// Stop limit order type - trigger fill once pass the stop price; but limit fill to limit price (3)
40  /// </summary>
41  StopLimit,
42 
43  /// <summary>
44  /// Market on open type - executed on exchange open (4)
45  /// </summary>
47 
48  /// <summary>
49  /// Market on close type - executed on exchange close (5)
50  /// </summary>
52 
53  /// <summary>
54  /// Option Exercise Order Type (6)
55  /// </summary>
57 
58  /// <summary>
59  /// Limit if Touched Order Type - a limit order to be placed after first reaching a trigger value (7)
60  /// </summary>
62 
63  /// <summary>
64  /// Combo Market Order Type - (8)
65  /// </summary>
67 
68  /// <summary>
69  /// Combo Limit Order Type - (9)
70  /// </summary>
71  ComboLimit,
72 
73  /// <summary>
74  /// Combo Leg Limit Order Type - (10)
75  /// </summary>
77 
78  /// <summary>
79  /// Trailing Stop Order Type - (11)
80  /// </summary>
82  }
83 
84  /// <summary>
85  /// Direction of the order
86  /// </summary>
87  public enum OrderDirection
88  {
89  /// <summary>
90  /// Buy Order (0)
91  /// </summary>
92  Buy,
93 
94  /// <summary>
95  /// Sell Order (1)
96  /// </summary>
97  Sell,
98 
99  /// <summary>
100  /// Default Value - No Order Direction (2)
101  /// </summary>
102  /// <remarks>
103  /// Unfortunately this does not have a value of zero because
104  /// there are backtests saved that reference the values in this order
105  /// </remarks>
106  Hold
107  }
108 
109  /// <summary>
110  /// Position of the order
111  /// </summary>
112  public enum OrderPosition
113  {
114  /// <summary>
115  /// Indicates the buy order will result in a long position, starting either from zero or an existing long position (0)
116  /// </summary>
117  BuyToOpen,
118 
119  /// <summary>
120  /// Indicates the buy order is starting from an existing short position, resulting in a closed or long position (1)
121  /// </summary>
122  BuyToClose,
123 
124  /// <summary>
125  /// Indicates the sell order will result in a short position, starting either from zero or an existing short position (2)
126  /// </summary>
127  SellToOpen,
128 
129  /// <summary>
130  /// Indicates the sell order is starting from an existing long position, resulting in a closed or short position (3)
131  /// </summary>
132  SellToClose,
133  }
134 
135  /// <summary>
136  /// Fill status of the order class.
137  /// </summary>
138  public enum OrderStatus
139  {
140  /// <summary>
141  /// New order pre-submission to the order processor (0)
142  /// </summary>
143  New = 0,
144 
145  /// <summary>
146  /// Order submitted to the market (1)
147  /// </summary>
148  Submitted = 1,
149 
150  /// <summary>
151  /// Partially filled, In Market Order (2)
152  /// </summary>
153  PartiallyFilled = 2,
154 
155  /// <summary>
156  /// Completed, Filled, In Market Order (3)
157  /// </summary>
158  Filled = 3,
159 
160  /// <summary>
161  /// Order cancelled before it was filled (5)
162  /// </summary>
163  Canceled = 5,
164 
165  /// <summary>
166  /// No Order State Yet (6)
167  /// </summary>
168  None = 6,
169 
170  /// <summary>
171  /// Order invalidated before it hit the market (e.g. insufficient capital) (7)
172  /// </summary>
173  Invalid = 7,
174 
175  /// <summary>
176  /// Order waiting for confirmation of cancellation (6)
177  /// </summary>
178  CancelPending = 8,
179 
180  /// <summary>
181  /// Order update submitted to the market (9)
182  /// </summary>
183  UpdateSubmitted = 9
184  }
185 }