QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BlackCalculator Class Reference

Black 1976 calculator class. More...

#include <ql/pricingengines/blackcalculator.hpp>

+ Inheritance diagram for BlackCalculator:
+ Collaboration diagram for BlackCalculator:

Public Member Functions

 BlackCalculator (const ext::shared_ptr< StrikedTypePayoff > &payoff, Real forward, Real stdDev, Real discount=1.0)
 
 BlackCalculator (Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount=1.0)
 
virtual ~BlackCalculator ()=default
 
Real value () const
 
Real deltaForward () const
 
virtual Real delta (Real spot) const
 
Real elasticityForward () const
 
virtual Real elasticity (Real spot) const
 
Real gammaForward () const
 
virtual Real gamma (Real spot) const
 
virtual Real theta (Real spot, Time maturity) const
 
virtual Real thetaPerDay (Real spot, Time maturity) const
 
Real vega (Time maturity) const
 
Real rho (Time maturity) const
 
Real dividendRho (Time maturity) const
 
Real itmCashProbability () const
 
Real itmAssetProbability () const
 
Real strikeSensitivity () const
 
Real strikeGamma () const
 
Real alpha () const
 
Real beta () const
 

Protected Member Functions

void initialize (const ext::shared_ptr< StrikedTypePayoff > &p)
 

Protected Attributes

Real strike_
 
Real forward_
 
Real stdDev_
 
Real discount_
 
Real variance_
 
Real d1_
 
Real d2_
 
Real alpha_
 
Real beta_
 
Real DalphaDd1_
 
Real DbetaDd2_
 
Real n_d1_
 
Real cum_d1_
 
Real n_d2_
 
Real cum_d2_
 
Real x_
 
Real DxDs_
 
Real DxDstrike_
 

Detailed Description

Black 1976 calculator class.

Bug:
When the variance is null, division by zero occur during the calculation of delta, delta forward, gamma, gamma forward, rho, dividend rho, vega, and strike sensitivity.
Examples
DiscreteHedging.cpp.

Definition at line 37 of file blackcalculator.hpp.

Constructor & Destructor Documentation

◆ BlackCalculator() [1/2]

BlackCalculator ( const ext::shared_ptr< StrikedTypePayoff > &  payoff,
Real  forward,
Real  stdDev,
Real  discount = 1.0 
)

Definition at line 45 of file blackcalculator.cpp.

+ Here is the call graph for this function:

◆ BlackCalculator() [2/2]

BlackCalculator ( Option::Type  optionType,
Real  strike,
Real  forward,
Real  stdDev,
Real  discount = 1.0 
)

Definition at line 54 of file blackcalculator.cpp.

◆ ~BlackCalculator()

virtual ~BlackCalculator ( )
virtualdefault
+ Here is the call graph for this function:

Member Function Documentation

◆ value()

Real value ( ) const
Examples
DiscreteHedging.cpp.

Definition at line 197 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ deltaForward()

Real deltaForward ( ) const

Sensitivity to change in the underlying forward price.

Definition at line 218 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ delta()

Real delta ( Real  spot) const
virtual

Sensitivity to change in the underlying spot price.

Reimplemented in BlackScholesCalculator.

Definition at line 202 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ elasticityForward()

Real elasticityForward ( ) const

Sensitivity in percent to a percent change in the underlying forward price.

Definition at line 242 of file blackcalculator.cpp.

+ Here is the call graph for this function:

◆ elasticity()

Real elasticity ( Real  spot) const
virtual

Sensitivity in percent to a percent change in the underlying spot price.

Reimplemented in BlackScholesCalculator.

Definition at line 229 of file blackcalculator.cpp.

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

◆ gammaForward()

Real gammaForward ( ) const

Second order derivative with respect to change in the underlying forward price.

Definition at line 275 of file blackcalculator.cpp.

◆ gamma()

Real gamma ( Real  spot) const
virtual

Second order derivative with respect to change in the underlying spot price.

Reimplemented in BlackScholesCalculator.

Definition at line 255 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ theta()

Real theta ( Real  spot,
Time  maturity 
) const
virtual

Sensitivity to time to maturity.

Reimplemented in BlackScholesCalculator.

Definition at line 290 of file blackcalculator.cpp.

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

◆ thetaPerDay()

Real thetaPerDay ( Real  spot,
Time  maturity 
) const
virtual

Sensitivity to time to maturity per day, assuming 365 day per year.

Reimplemented in BlackScholesCalculator.

Definition at line 120 of file blackcalculator.hpp.

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

◆ vega()

Real vega ( Time  maturity) const

Sensitivity to volatility.

Examples
DiscreteHedging.cpp.

Definition at line 301 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ rho()

Real rho ( Time  maturity) const

Sensitivity to discounting rate.

Definition at line 316 of file blackcalculator.cpp.

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

◆ dividendRho()

Real dividendRho ( Time  maturity) const

Sensitivity to dividend/growth rate.

Definition at line 328 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ itmCashProbability()

Real itmCashProbability ( ) const

Probability of being in the money in the bond martingale measure, i.e. N(d2). It is a risk-neutral probability, not the real world one.

Definition at line 125 of file blackcalculator.hpp.

+ Here is the caller graph for this function:

◆ itmAssetProbability()

Real itmAssetProbability ( ) const

Probability of being in the money in the asset martingale measure, i.e. N(d1). It is a risk-neutral probability, not the real world one.

Definition at line 129 of file blackcalculator.hpp.

◆ strikeSensitivity()

Real strikeSensitivity ( ) const

Sensitivity to strike.

Definition at line 341 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

◆ strikeGamma()

Real strikeGamma ( ) const

gamma w.r.t. strike.

Definition at line 354 of file blackcalculator.cpp.

◆ alpha()

Real alpha ( ) const

Definition at line 133 of file blackcalculator.hpp.

◆ beta()

Real beta ( ) const

Definition at line 137 of file blackcalculator.hpp.

+ Here is the caller graph for this function:

◆ initialize()

void initialize ( const ext::shared_ptr< StrikedTypePayoff > &  p)
protected

Definition at line 65 of file blackcalculator.cpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ strike_

Real strike_
protected

Definition at line 112 of file blackcalculator.hpp.

◆ forward_

Real forward_
protected

Definition at line 112 of file blackcalculator.hpp.

◆ stdDev_

Real stdDev_
protected

Definition at line 112 of file blackcalculator.hpp.

◆ discount_

Real discount_
protected

Definition at line 112 of file blackcalculator.hpp.

◆ variance_

Real variance_
protected

Definition at line 112 of file blackcalculator.hpp.

◆ d1_

Real d1_
protected

Definition at line 113 of file blackcalculator.hpp.

◆ d2_

Real d2_
protected

Definition at line 113 of file blackcalculator.hpp.

◆ alpha_

Real alpha_
protected

Definition at line 114 of file blackcalculator.hpp.

◆ beta_

Real beta_
protected

Definition at line 114 of file blackcalculator.hpp.

◆ DalphaDd1_

Real DalphaDd1_
protected

Definition at line 114 of file blackcalculator.hpp.

◆ DbetaDd2_

Real DbetaDd2_
protected

Definition at line 114 of file blackcalculator.hpp.

◆ n_d1_

Real n_d1_
protected

Definition at line 115 of file blackcalculator.hpp.

◆ cum_d1_

Real cum_d1_
protected

Definition at line 115 of file blackcalculator.hpp.

◆ n_d2_

Real n_d2_
protected

Definition at line 115 of file blackcalculator.hpp.

◆ cum_d2_

Real cum_d2_
protected

Definition at line 115 of file blackcalculator.hpp.

◆ x_

Real x_
protected

Definition at line 116 of file blackcalculator.hpp.

◆ DxDs_

Real DxDs_
protected

Definition at line 116 of file blackcalculator.hpp.

◆ DxDstrike_

Real DxDstrike_
protected

Definition at line 116 of file blackcalculator.hpp.