Lean  $LEAN_TAG$
ComboMarketOrder.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;
19 
20 namespace QuantConnect.Orders
21 {
22  /// <summary>
23  /// Combo market order type
24  /// </summary>
26  {
27  /// <summary>
28  /// Combo Market Order Type
29  /// </summary>
30  public override OrderType Type => OrderType.ComboMarket;
31 
32  /// <summary>
33  /// Added a default constructor for JSON Deserialization:
34  /// </summary>
35  public ComboMarketOrder() : base()
36  {
37  }
38 
39  /// <summary>
40  /// New market order constructor
41  /// </summary>
42  /// <param name="symbol">Symbol asset we're seeking to trade</param>
43  /// <param name="quantity">Quantity of the asset we're seeking to trade</param>
44  /// <param name="time">Time the order was placed</param>
45  /// <param name="groupOrderManager">Manager for the orders in the group</param>
46  /// <param name="tag">User defined data tag for this order</param>
47  /// <param name="properties">The order properties for this order</param>
48  public ComboMarketOrder(Symbol symbol, decimal quantity, DateTime time, GroupOrderManager groupOrderManager, string tag = "",
49  IOrderProperties properties = null)
50  : base(symbol, quantity, time, groupOrderManager, tag, properties)
51  {
52  }
53 
54  /// <summary>
55  /// Gets the order value in units of the security's quote currency
56  /// </summary>
57  /// <param name="security">The security matching this order's symbol</param>
58  protected override decimal GetValueImpl(Security security)
59  {
60  return Quantity * security.Price;
61  }
62 
63  /// <summary>
64  /// Creates a deep-copy clone of this order
65  /// </summary>
66  /// <returns>A copy of this order</returns>
67  public override Order Clone()
68  {
69  var order = new ComboMarketOrder();
70  CopyTo(order);
71  return order;
72  }
73  }
74 }