/* * 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.Securities.Option; namespace QuantConnect.Securities.IndexOption { /// /// Index Option Symbol Properties /// public class IndexOptionSymbolProperties : OptionSymbolProperties { private BaseData _lastData; /// /// Minimum price variation, subject to variability due to contract price /// public override decimal MinimumPriceVariation => MinimumPriceVariationForPrice(_lastData?.Symbol, _lastData?.Price); /// /// Creates an instance of index symbol properties /// /// Description of the Symbol /// Currency the price is quoted in /// Contract multiplier of the index option /// Minimum price variation /// Minimum order lot size public IndexOptionSymbolProperties( string description, string quoteCurrency, decimal contractMultiplier, decimal pipSize, decimal lotSize ) : base(description, quoteCurrency, contractMultiplier, pipSize, lotSize) { } /// /// Creates instance of index symbol properties /// /// public IndexOptionSymbolProperties(SymbolProperties properties) : base(properties) { } /// /// Updates the last data received, required for calculating some /// index options contracts that have a variable step size for their premium's quotes /// /// Data to update with internal void UpdateMarketPrice(BaseData marketData) { _lastData = marketData; } /// /// Minimum price variation, subject to variability due to contract price /// /// https://www.cboe.com/tradable_products/vix/vix_options/specifications/ /// https://www.cboe.com/tradable_products/sp_500/spx_options/specifications/ /// https://www.nasdaq.com/docs/2022/08/24/1926-Q22_NDX%20Fact%20Sheet_NAM_v3.pdf public static decimal MinimumPriceVariationForPrice(Symbol symbol, decimal? referencePrice) { if(symbol == null || !referencePrice.HasValue) { return 0.05m; } var aboveThree = 0.1m; var belowThree = 0.05m; if(symbol.ID.Symbol == "VIXW") { aboveThree = belowThree = 0.01m; } else if (symbol.ID.Symbol == "VIX") { belowThree = 0.01m; aboveThree = 0.05m; } return referencePrice.HasValue && referencePrice >= 3m ? aboveThree : belowThree; } } }