double BlackScholes( char CallPutFlag, double S, double X, double T, double v, double r, double b )
{
double d1, d2, bs = 0.0;
d1 = (log(S / X) + (b + pow(v,2) / 2.0) * T) / (v * sqrt(T));
d2 = d1 - v * sqrt(T);
if ( CallPutFlag == 'C' )
bs = S * exp((b - r) * T) * CND(d1) - X * exp(-r * T) * CND(d2);
else if ( CallPutFlag == 'P' )
bs = X * exp(-r * T) * CND(-d2) - S * exp((b - r) * T) * CND(-d1);
return bs;
}
|
It should be recognised when using Black-76 to price Interest Rate Options: a) The underlying asset is lognormally distributed b) With a cap the underlying Forward/Future rates are assumed to be lognormal c) With a swaption (option on a swap) the underlying swap rate is assumed to be lognormal As such a simultaneous valuation of both a cap and a swaption with the Black-76 model is theoretically inconsistant. Both the forward rate of the cap and the swap rate cannot be lognormal simultaneously. This also applies to bond prices and swap rates: they cannot be lognormal at the same time. If the bond price is assumed to be lognormal then the continuously compounded swap rate must be normally distributed. The practical workaround is to adjust the volatility to kludge the option price based on trader experience. Finally this leads to the Cumulative Normal Distribution [CND() - not shown here] function This can be found in most text books. It is possible to use as little as four digit accuracy but it is much better to use six digit accuracy. Note 1 / 64 = 0.015625. Professor Mark Garman in the 1980's recommended a CND() function to seven digits for Monetary Derivatives.
Public Function GDelta(CallPutFlag As String, S As Double, X As Double, T As Double, r As Double, b As Double, v As Double) As Double
Dim d1 As Double
d1 = (Log(S / X) + (b + v ^ 2 / 2) * T) / (v * Sqr(T))
If CallPutFlag = "c" Then
GDelta = Exp((b - r) * T) * CND(d1)
ElseIf CallPutFlag = "p" Then
GDelta = Exp((b - r) * T) * (CND(d1) - 1)
End If
End Function