Lean
$LEAN_TAG$
MarketOnOpenOrder.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;
17
using
QuantConnect
.
Interfaces
;
18
using
QuantConnect
.
Securities
;
19
20
namespace
QuantConnect.Orders
21
{
22
/// <summary>
23
/// Market on Open order type, submits a market order when the exchange opens
24
/// </summary>
25
public
class
MarketOnOpenOrder
:
Order
26
{
27
/// <summary>
28
/// MarketOnOpen Order Type
29
/// </summary>
30
public
override
OrderType
Type
31
{
32
get
{
return
OrderType
.MarketOnOpen; }
33
}
34
35
/// <summary>
36
/// Intiializes a new instance of the <see cref="MarketOnOpenOrder"/> class.
37
/// </summary>
38
public
MarketOnOpenOrder
()
39
{
40
}
41
42
/// <summary>
43
/// Intiializes a new instance of the <see cref="MarketOnOpenOrder"/> class.
44
/// </summary>
45
/// <param name="symbol">The security's symbol being ordered</param>
46
/// <param name="quantity">The number of units to order</param>
47
/// <param name="time">The current time</param>
48
/// <param name="tag">A user defined tag for the order</param>
49
/// <param name="properties">The order properties for this order</param>
50
public
MarketOnOpenOrder
(
Symbol
symbol, decimal quantity, DateTime time,
string
tag =
""
,
IOrderProperties
properties =
null
)
51
: base(symbol, quantity, time, tag, properties)
52
{
53
}
54
55
/// <summary>
56
/// Gets the order value in units of the security's quote currency
57
/// </summary>
58
/// <param name="security">The security matching this order's symbol</param>
59
protected
override
decimal
GetValueImpl
(
Security
security)
60
{
61
return
Quantity
*security.
Price
;
62
}
63
64
/// <summary>
65
/// Creates a deep-copy clone of this order
66
/// </summary>
67
/// <returns>A copy of this order</returns>
68
public
override
Order
Clone
()
69
{
70
var order =
new
MarketOnOpenOrder
();
71
CopyTo
(order);
72
return
order;
73
}
74
}
75
}
Common
Orders
MarketOnOpenOrder.cs
Generated by
1.8.17