Lean  $LEAN_TAG$
QuantConnect.Securities.Option.QLOptionPriceModel Class Reference

Provides QuantLib(QL) implementation of IOptionPriceModel to support major option pricing models, available in QL. More...

Inheritance diagram for QuantConnect.Securities.Option.QLOptionPriceModel:
[legend]

Public Member Functions

 QLOptionPriceModel (PricingEngineFunc pricingEngineFunc, IQLUnderlyingVolatilityEstimator underlyingVolEstimator=null, IQLRiskFreeRateEstimator riskFreeRateEstimator=null, IQLDividendYieldEstimator dividendYieldEstimator=null, OptionStyle[] allowedOptionStyles=null)
 Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield More...
 
 QLOptionPriceModel (PricingEngineFuncEx pricingEngineFunc, IQLUnderlyingVolatilityEstimator underlyingVolEstimator=null, IQLRiskFreeRateEstimator riskFreeRateEstimator=null, IQLDividendYieldEstimator dividendYieldEstimator=null, OptionStyle[] allowedOptionStyles=null)
 Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield More...
 
OptionPriceModelResult Evaluate (Security security, Slice slice, OptionContract contract)
 Evaluates the specified option contract to compute a theoretical price, IV and greeks More...
 

Public Attributes

bool VolatilityEstimatorWarmedUp => _underlyingVolEstimator.IsReady
 True if volatility model is warmed up, i.e. has generated volatility value different from zero, otherwise false. More...
 

Protected Member Functions

double ImpliedVolatilityEstimation (double price, double initialGuess, double timeTillExpiry, double riskFreeDiscount, double forwardPrice, PlainVanillaPayoff payoff, out BlackCalculator black)
 An implied volatility approximation by Newton-Raphson method. Return 0 if result is not converged More...
 

Properties

bool EnableGreekApproximation = true [get, set]
 When enabled, approximates Greeks if corresponding pricing model didn't calculate exact numbers. The default value is true. More...
 
IReadOnlyCollection< OptionStyleAllowedOptionStyles [get]
 List of option styles supported by the pricing model. By default, both American and European option styles are supported. More...
 

Detailed Description

Provides QuantLib(QL) implementation of IOptionPriceModel to support major option pricing models, available in QL.

Definition at line 33 of file QLOptionPriceModel.cs.

Constructor & Destructor Documentation

◆ QLOptionPriceModel() [1/2]

QuantConnect.Securities.Option.QLOptionPriceModel.QLOptionPriceModel ( PricingEngineFunc  pricingEngineFunc,
IQLUnderlyingVolatilityEstimator  underlyingVolEstimator = null,
IQLRiskFreeRateEstimator  riskFreeRateEstimator = null,
IQLDividendYieldEstimator  dividendYieldEstimator = null,
OptionStyle[]  allowedOptionStyles = null 
)

Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield

Parameters
pricingEngineFuncFunction modeled stochastic process, and returns new pricing engine to run calculations for that option
underlyingVolEstimatorThe underlying volatility estimator
riskFreeRateEstimatorThe risk free rate estimator
dividendYieldEstimatorThe underlying dividend yield estimator
allowedOptionStylesList of option styles supported by the pricing model. It defaults to both American and European option styles

Definition at line 70 of file QLOptionPriceModel.cs.

◆ QLOptionPriceModel() [2/2]

QuantConnect.Securities.Option.QLOptionPriceModel.QLOptionPriceModel ( PricingEngineFuncEx  pricingEngineFunc,
IQLUnderlyingVolatilityEstimator  underlyingVolEstimator = null,
IQLRiskFreeRateEstimator  riskFreeRateEstimator = null,
IQLDividendYieldEstimator  dividendYieldEstimator = null,
OptionStyle[]  allowedOptionStyles = null 
)

Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield

Parameters
pricingEngineFuncFunction takes option and modeled stochastic process, and returns new pricing engine to run calculations for that option
underlyingVolEstimatorThe underlying volatility estimator
riskFreeRateEstimatorThe risk free rate estimator
dividendYieldEstimatorThe underlying dividend yield estimator
allowedOptionStylesList of option styles supported by the pricing model. It defaults to both American and European option styles

Definition at line 85 of file QLOptionPriceModel.cs.

Member Function Documentation

◆ Evaluate()

OptionPriceModelResult QuantConnect.Securities.Option.QLOptionPriceModel.Evaluate ( Security  security,
Slice  slice,
OptionContract  contract 
)

Evaluates the specified option contract to compute a theoretical price, IV and greeks

Parameters
securityThe option security object
sliceThe current data slice. This can be used to access other information available to the algorithm
contractThe option contract to evaluate
Returns
An instance of OptionPriceModelResult containing the theoretical price of the specified option contract

Implements QuantConnect.Securities.Option.IOptionPriceModel.

Definition at line 108 of file QLOptionPriceModel.cs.

Here is the call graph for this function:

◆ ImpliedVolatilityEstimation()

double QuantConnect.Securities.Option.QLOptionPriceModel.ImpliedVolatilityEstimation ( double  price,
double  initialGuess,
double  timeTillExpiry,
double  riskFreeDiscount,
double  forwardPrice,
PlainVanillaPayoff  payoff,
out BlackCalculator  black 
)
protected

An implied volatility approximation by Newton-Raphson method. Return 0 if result is not converged

Orlando G, Taglialatela G. A review on implied volatility calculation. Journal of Computational and Applied Mathematics. 2017 Aug 15;320:202-20. https://www.sciencedirect.com/science/article/pii/S0377042717300602

Parameters
pricecurrent price of the option
initialGuessinitial guess of the IV
timeTillExpirytime till option contract expiry
riskFreeDiscountrisk free rate discount factor
forwardPricefuture value of underlying price
payoffpayoff structure of the option contract
blackblack calculator instance
Returns
implied volatility estimation

Definition at line 346 of file QLOptionPriceModel.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ VolatilityEstimatorWarmedUp

bool QuantConnect.Securities.Option.QLOptionPriceModel.VolatilityEstimatorWarmedUp => _underlyingVolEstimator.IsReady

True if volatility model is warmed up, i.e. has generated volatility value different from zero, otherwise false.

Definition at line 54 of file QLOptionPriceModel.cs.

Property Documentation

◆ EnableGreekApproximation

bool QuantConnect.Securities.Option.QLOptionPriceModel.EnableGreekApproximation = true
getset

When enabled, approximates Greeks if corresponding pricing model didn't calculate exact numbers. The default value is true.

Definition at line 49 of file QLOptionPriceModel.cs.

◆ AllowedOptionStyles

IReadOnlyCollection<OptionStyle> QuantConnect.Securities.Option.QLOptionPriceModel.AllowedOptionStyles
get

List of option styles supported by the pricing model. By default, both American and European option styles are supported.

Definition at line 60 of file QLOptionPriceModel.cs.


The documentation for this class was generated from the following file: