Exemplo n.º 1
0
 /// <summary>
 /// Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield
 /// </summary>
 /// <param name="pricingEngineFunc">Function takes option and modeled stochastic process, and returns new pricing engine to run calculations for that option</param>
 /// <param name="underlyingVolEstimator">The underlying volatility estimator</param>
 /// <param name="riskFreeRateEstimator">The risk free rate estimator</param>
 /// <param name="dividendYieldEstimator">The underlying dividend yield estimator</param>
 public QLOptionPriceModel(PricingEngineFuncEx pricingEngineFunc, IQLUnderlyingVolatilityEstimator underlyingVolEstimator, IQLRiskFreeRateEstimator riskFreeRateEstimator, IQLDividendYieldEstimator dividendYieldEstimator)
 {
     _pricingEngineFunc      = pricingEngineFunc;
     _underlyingVolEstimator = underlyingVolEstimator ?? new ConstantQLUnderlyingVolatilityEstimator();
     _riskFreeRateEstimator  = riskFreeRateEstimator ?? new ConstantQLRiskFreeRateEstimator();
     _dividendYieldEstimator = dividendYieldEstimator ?? new ConstantQLDividendYieldEstimator();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield
        /// </summary>
        /// <param name="pricingEngineFunc">Function takes option and modeled stochastic process, and returns new pricing engine to run calculations for that option</param>
        /// <param name="underlyingVolEstimator">The underlying volatility estimator</param>
        /// <param name="riskFreeRateEstimator">The risk free rate estimator</param>
        /// <param name="dividendYieldEstimator">The underlying dividend yield estimator</param>
        /// <param name="allowedOptionStyles">List of option styles supported by the pricing model. It defaults to both American and European option styles</param>
        public QLOptionPriceModel(PricingEngineFuncEx pricingEngineFunc, IQLUnderlyingVolatilityEstimator underlyingVolEstimator, IQLRiskFreeRateEstimator riskFreeRateEstimator, IQLDividendYieldEstimator dividendYieldEstimator, OptionStyle[] allowedOptionStyles = null)
        {
            _pricingEngineFunc      = pricingEngineFunc;
            _underlyingVolEstimator = underlyingVolEstimator ?? new ConstantQLUnderlyingVolatilityEstimator();
            _riskFreeRateEstimator  = riskFreeRateEstimator ?? new ConstantQLRiskFreeRateEstimator();
            _dividendYieldEstimator = dividendYieldEstimator ?? new ConstantQLDividendYieldEstimator();

            AllowedOptionStyles = allowedOptionStyles ?? _defaultAllowedOptionStyles;

            // Required for QL to consider the option as not expired on the expiration date.
            // This is done in the constructor instead of a static contructor because QLNet.Settings attributes are ThreadStatic,
            // so doing it in a static constructor would only set it for the first thread that instantiates QLOptionPriceModel or
            // accesses any of its static members.
            QLNet.Settings.includeReferenceDateEvents = true;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Method constructs QuantLib option price model with necessary estimators of underlying volatility, risk free rate, and underlying dividend yield
 /// </summary>
 /// <param name="pricingEngineFunc">Function modeled stochastic process, and returns new pricing engine to run calculations for that option</param>
 /// <param name="underlyingVolEstimator">The underlying volatility estimator</param>
 /// <param name="riskFreeRateEstimator">The risk free rate estimator</param>
 /// <param name="dividendYieldEstimator">The underlying dividend yield estimator</param>
 /// <param name="allowedOptionStyles">List of option styles supported by the pricing model. It defaults to both American and European option styles</param>
 public QLOptionPriceModel(PricingEngineFunc pricingEngineFunc, IQLUnderlyingVolatilityEstimator underlyingVolEstimator, IQLRiskFreeRateEstimator riskFreeRateEstimator, IQLDividendYieldEstimator dividendYieldEstimator, OptionStyle[] allowedOptionStyles = null)
     : this((option, process) => pricingEngineFunc(process), underlyingVolEstimator, riskFreeRateEstimator, dividendYieldEstimator, allowedOptionStyles)
 {
 }