/* * QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. * Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using QuantConnect.Data; using QuantConnect.Orders.Fees; using QuantConnect.Orders.Fills; using QuantConnect.Orders.Slippage; using QuantConnect.Securities.Option; namespace QuantConnect.Securities.IndexOption { /// /// Index Options security /// public class IndexOption : Option.Option { /// /// Constructor for the index option security /// /// Symbol of the index option /// Exchange hours of the index option /// Quoted currency of the index option /// Symbol properties of the index option /// Currency converter /// Provides all data types registered to the algorithm /// Cache of security objects /// Future underlying security /// Settlement type for the index option. Most index options are cash-settled. public IndexOption(Symbol symbol, SecurityExchangeHours exchangeHours, Cash quoteCurrency, IndexOptionSymbolProperties symbolProperties, ICurrencyConverter currencyConverter, IRegisteredSecurityDataTypesProvider registeredTypes, SecurityCache securityCache, Security underlying, SettlementType settlementType = SettlementType.Cash) : base(symbol, quoteCurrency, symbolProperties, new OptionExchange(exchangeHours), securityCache, new OptionPortfolioModel(), new ImmediateFillModel(), new InteractiveBrokersFeeModel(), NullSlippageModel.Instance, new ImmediateSettlementModel(), Securities.VolatilityModel.Null, new OptionMarginModel(), new OptionDataFilter(), new IndexOptionPriceVariationModel(), currencyConverter, registeredTypes, underlying ) { ExerciseSettlement = settlementType; } /// /// Consumes market price data and updates the minimum price variation /// /// Market price data /// /// Index options have variable sized minimum price variations. /// For prices greater than or equal to $3.00 USD, the minimum price variation is $0.10 USD. /// For prices less than $3.00 USD, the minimum price variation is $0.05 USD. /// protected override void UpdateConsumersMarketPrice(BaseData data) { base.UpdateConsumersMarketPrice(data); ((IndexOptionSymbolProperties)SymbolProperties).UpdateMarketPrice(data); } /// /// Updates the symbol properties of this security /// internal override void UpdateSymbolProperties(SymbolProperties symbolProperties) { if (symbolProperties != null) { SymbolProperties = new IndexOptionSymbolProperties(symbolProperties); } } } }