/*
* 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;
using QuantConnect.Securities.Option;
namespace QuantConnect.Indicators
{
///
/// Provides option price models for option securities based on Lean's Greeks indicators
///
public class IndicatorBasedOptionPriceModelProvider : IOptionPriceModelProvider
{
///
/// Gets the security manager instance to use
///
public SecurityManager Securities { get; }
///
/// Creates a new instance of the class
///
public IndicatorBasedOptionPriceModelProvider(SecurityManager securities)
{
Securities = securities;
}
///
/// Gets the option price model for the specified option symbol
///
/// The symbol
/// The option pricing model type to use
/// The option price model for the given symbol
public IOptionPriceModel GetOptionPriceModel(Symbol symbol, OptionPricingModelType? pricingModelType = null)
{
return new IndicatorBasedOptionPriceModel(pricingModelType, pricingModelType, securityProvider: Securities);
}
///
/// Gets the option price model with the specified configuration
///
/// The option pricing model type to be used by the indicators
/// The option pricing model type to be used by the implied volatility indicator
/// The dividend yield model to be used by the indicators
/// The risk free interest rate model to be used by the indicatorsv
/// Whether to use the mirror contract when possible
/// The option price model for the given symbol
public IOptionPriceModel GetOptionPriceModel(OptionPricingModelType? optionModel = null,
OptionPricingModelType? ivModel = null, IDividendYieldModel dividendYieldModel = null,
IRiskFreeInterestRateModel riskFreeInterestRateModel = null,
bool useMirrorContract = true)
{
return new IndicatorBasedOptionPriceModel(optionModel, ivModel, dividendYieldModel, riskFreeInterestRateModel, useMirrorContract, securityProvider: Securities);
}
}
}