/* * 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 System; namespace QuantConnect.Securities.Option { /// /// Static class contains definitions of major option pricing models that can be used in LEAN /// /// /// To introduce particular model into algorithm add the following line to the algorithm's Initialize() method: /// /// option.PriceModel = OptionPriceModels.BlackScholes(); // Option pricing model of choice /// /// public static partial class OptionPriceModels { /// /// Default option price model provider used by LEAN when creating price models. /// internal static IOptionPriceModelProvider DefaultPriceModelProvider { get; set; } /// /// Null pricing engine that returns the current price as the option theoretical price. /// It will also set the option Greeks and implied volatility to zero, effectively disabling the pricing. /// public static IOptionPriceModel Null() { return new CurrentPriceOptionPriceModel(); } /// /// Pricing engine for Black-Scholes model. /// /// New option price model instance public static IOptionPriceModel BlackScholes() { return DefaultPriceModelProvider.GetOptionPriceModel(Symbol.Empty, Indicators.OptionPricingModelType.BlackScholes); } /// /// Pricing engine for Cox-Ross-Rubinstein (CRR) model. /// /// New option price model instance public static IOptionPriceModel BinomialCoxRossRubinstein() { return DefaultPriceModelProvider.GetOptionPriceModel(Symbol.Empty, Indicators.OptionPricingModelType.BinomialCoxRossRubinstein); } /// /// Pricing engine for forward binomial tree model. /// /// New option price model instance public static IOptionPriceModel ForwardTree() { return DefaultPriceModelProvider.GetOptionPriceModel(Symbol.Empty, Indicators.OptionPricingModelType.ForwardTree); } } }