Lean
$LEAN_TAG$
IndexOption.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
.
Data
;
17
using
QuantConnect
.
Orders
.
Fees
;
18
using
QuantConnect
.
Orders
.
Fills
;
19
using
QuantConnect
.
Orders
.
Slippage
;
20
using
QuantConnect
.
Securities
.
Option
;
21
22
namespace
QuantConnect.Securities.IndexOption
23
{
24
/// <summary>
25
/// Index Options security
26
/// </summary>
27
public
class
IndexOption
:
Option
.
Option
28
{
29
/// <summary>
30
/// Constructor for the index option security
31
/// </summary>
32
/// <param name="symbol">Symbol of the index option</param>
33
/// <param name="exchangeHours">Exchange hours of the index option</param>
34
/// <param name="quoteCurrency">Quoted currency of the index option</param>
35
/// <param name="symbolProperties">Symbol properties of the index option</param>
36
/// <param name="currencyConverter">Currency converter</param>
37
/// <param name="registeredTypes">Provides all data types registered to the algorithm</param>
38
/// <param name="securityCache">Cache of security objects</param>
39
/// <param name="underlying">Future underlying security</param>
40
/// <param name="settlementType">Settlement type for the index option. Most index options are cash-settled.</param>
41
public
IndexOption
(
Symbol
symbol,
42
SecurityExchangeHours
exchangeHours,
43
Cash
quoteCurrency,
44
IndexOptionSymbolProperties
symbolProperties,
45
ICurrencyConverter
currencyConverter,
46
IRegisteredSecurityDataTypesProvider
registeredTypes,
47
SecurityCache
securityCache,
48
Security
underlying,
49
SettlementType
settlementType =
SettlementType
.Cash)
50
: base(symbol,
51
quoteCurrency,
52
symbolProperties,
53
new
OptionExchange
(exchangeHours),
54
securityCache,
55
new
OptionPortfolioModel
(),
56
new
ImmediateFillModel
(),
57
new
InteractiveBrokersFeeModel
(),
58
NullSlippageModel
.Instance,
59
new
ImmediateSettlementModel
(),
60
Securities.
VolatilityModel
.Null,
61
new
OptionMarginModel
(),
62
new
OptionDataFilter
(),
63
new
IndexOptionPriceVariationModel
(),
64
currencyConverter,
65
registeredTypes,
66
underlying
67
)
68
{
69
ExerciseSettlement
= settlementType;
70
}
71
72
/// <summary>
73
/// Consumes market price data and updates the minimum price variation
74
/// </summary>
75
/// <param name="data">Market price data</param>
76
/// <remarks>
77
/// Index options have variable sized minimum price variations.
78
/// For prices greater than or equal to $3.00 USD, the minimum price variation is $0.10 USD.
79
/// For prices less than $3.00 USD, the minimum price variation is $0.05 USD.
80
/// </remarks>
81
protected
override
void
UpdateConsumersMarketPrice
(
BaseData
data)
82
{
83
base.UpdateConsumersMarketPrice(data);
84
((
IndexOptionSymbolProperties
)
SymbolProperties
).UpdateMarketPrice(data);
85
}
86
87
/// <summary>
88
/// Updates the symbol properties of this security
89
/// </summary>
90
internal
override
void
UpdateSymbolProperties(
SymbolProperties
symbolProperties)
91
{
92
if
(symbolProperties !=
null
)
93
{
94
SymbolProperties
=
new
IndexOptionSymbolProperties
(symbolProperties);
95
}
96
}
97
}
98
}
Common
Securities
IndexOption
IndexOption.cs
Generated by
1.8.17