Table of Contents

Class BachelierCalculator

Namespace
NanoQL.PricingEngines
Assembly
NanoQL.dll

The Bachelier calculator: the value and sensitivities of a striked payoff on a forward with a normal distribution of a given standard deviation (in price units), discounted. It supports plain vanilla, cash-or-nothing, asset-or-nothing and gap payoffs.

public sealed class BachelierCalculator
Inheritance
BachelierCalculator
Inherited Members

Remarks

Three of QuantLib's results are fixed, documented divergences:

  • QuantLib tells a call from a put by alpha >= 0 (bacheliercalculator.cpp:102-114, :183-188), which a put's N(d) − 1 meets where N(d) rounds to 1, so a put far out of the money prices as the call; here the payoff's type decides (Divergences/BachelierPutBranchTests.cs).
  • QuantLib's visitor sets alpha, beta and x for cash-or-nothing, asset-or-nothing and gap payoffs, which its value and Greeks never read, so each prices as the plain vanilla; here the value is D·(F·α + x·β + σ·∂α/∂d) and the Greeks its derivatives, Bachelier's closed forms for each payoff (Divergences/BachelierPayoffTests.cs). The plain vanilla's are QuantLib's expressions.
  • QuantLib's theta reads the spot gamma where the time decay reads the forward gamma, missing (S/F)²; its vanna, the sensitivity of the vega to the spot by its documentation, misses D·F/S; its volga divides by σ√T where the derivative in σ divides by σ, missing √T. Each is here the derivative, the vanna taking the spot as Vanna(double, double) does (Divergences/BachelierGreeksTests.cs).

Immutable. At a standard deviation within QL_EPSILON the density terms are 0, as QuantLib's: the value is the discounted payoff at the forward, the gammas, vega, vanna and volga 0.

Constructors

BachelierCalculator(StrikedTypePayoff, double, double, double)

Initializes a new instance of the BachelierCalculator class for a striked payoff.

public BachelierCalculator(StrikedTypePayoff payoff, double forward, double stdDev, double discount = 1)

Parameters

payoff StrikedTypePayoff

The payoff.

forward double

The forward.

stdDev double

The standard deviation of the underlying at expiry, in price units.

discount double

The discount factor.

Exceptions

ArgumentNullException

payoff is null.

ArgumentException

The standard deviation is negative, the discount isn't positive, or the payoff isn't a plain vanilla, cash-or-nothing, asset-or-nothing or gap payoff.

BachelierCalculator(OptionType, double, double, double, double)

Initializes a new instance of the BachelierCalculator class for a plain vanilla payoff.

public BachelierCalculator(OptionType optionType, double strike, double forward, double stdDev, double discount = 1)

Parameters

optionType OptionType

The option's type.

strike double

The strike.

forward double

The forward.

stdDev double

The standard deviation of the underlying at expiry, in price units.

discount double

The discount factor.

Exceptions

ArgumentOutOfRangeException

optionType isn't a member of its type.

ArgumentException

The standard deviation is negative, or the discount isn't positive.

Properties

Alpha

Gets alpha, the forward's coefficient in the value.

public double Alpha { get; }

Property Value

double

Beta

Gets beta, the strike's (or cash's) coefficient in the value.

public double Beta { get; }

Property Value

double

DeltaForward

Gets the sensitivity to the forward.

public double DeltaForward { get; }

Property Value

double

ElasticityForward

Gets the sensitivity in percent to a percent change in the forward.

public double ElasticityForward { get; }

Property Value

double

GammaForward

Gets the second-order sensitivity to the forward.

public double GammaForward { get; }

Property Value

double

ItmAssetProbability

Gets the probability of being in the money in the asset martingale measure: N(d), 1 − N(d) for a put.

public double ItmAssetProbability { get; }

Property Value

double

ItmCashProbability

Gets the probability of being in the money in the bond martingale measure: N(d), 1 − N(d) for a put.

public double ItmCashProbability { get; }

Property Value

double

StrikeGamma

Gets the second-order sensitivity to the strike.

public double StrikeGamma { get; }

Property Value

double

StrikeSensitivity

Gets the sensitivity to the strike.

public double StrikeSensitivity { get; }

Property Value

double

Value

Gets the value: the plain vanilla's Bachelier formula, otherwise D·(F·α + x·β + σ·∂α/∂d).

public double Value { get; }

Property Value

double

Methods

Delta(double)

The sensitivity to the spot.

public double Delta(double spot)

Parameters

spot double

The spot.

Returns

double

The delta, the forward delta times F/S.

DividendRho(double)

The sensitivity to the dividend yield.

public double DividendRho(double maturity)

Parameters

maturity double

The time to maturity.

Returns

double

The dividend rho.

Exceptions

ArgumentException

The maturity is negative.

Elasticity(double)

The sensitivity in percent to a percent change in the spot.

public double Elasticity(double spot)

Parameters

spot double

The spot.

Returns

double

The elasticity.

Gamma(double)

The second-order sensitivity to the spot.

public double Gamma(double spot)

Parameters

spot double

The spot.

Returns

double

The gamma, the forward gamma times (F/S)².

Rho(double)

The sensitivity to the risk-free rate.

public double Rho(double maturity)

Parameters

maturity double

The time to maturity.

Returns

double

The rho.

Exceptions

ArgumentException

The maturity is negative.

Theta(double, double)

The sensitivity to the time to maturity.

public double Theta(double spot, double maturity)

Parameters

spot double

The spot.

maturity double

The time to maturity.

Returns

double

The theta; 0 at a maturity close to 0.

Exceptions

ArgumentException

The maturity is negative.

ThetaPerDay(double, double)

The sensitivity to the time to maturity per day, assuming 365 days a year.

public double ThetaPerDay(double spot, double maturity)

Parameters

spot double

The spot.

maturity double

The time to maturity.

Returns

double

The theta per day.

Exceptions

ArgumentException

The maturity is negative.

Vanna(double, double)

The sensitivity of the vega to the spot (vanna): QuantLib's documented quantity, its forward form times D·F/S, which QuantLib's misses.

public double Vanna(double spot, double maturity)

Parameters

spot double

The spot.

maturity double

The time to maturity.

Returns

double

The vanna.

Vega(double)

The sensitivity to the volatility σ, the standard deviation being σ√T.

public double Vega(double maturity)

Parameters

maturity double

The time to maturity.

Returns

double

The vega.

Exceptions

ArgumentException

The maturity is negative.

Volga(double)

The sensitivity of the vega to the volatility (volga): QuantLib's times √T, which QuantLib's misses.

public double Volga(double maturity)

Parameters

maturity double

The time to maturity.

Returns

double

The volga.