Bojan Nikolic: Using and Understanding the QuantLib Addin

[website home] | [BN Algorithms]

qlBlackVarianceSurface – Create volatility structure represented by variance surface

This function creates a volatility structure which is represented by a surface in variance values in the space of (strike, maturity) points. Volatility for an arbitrary point in the parameter space is returned by bi-linear interpolation of variance. This function can be used in place of qlBlackConstantVol – Create a Volatility Structure with constant volatility for all times and strikes in all the examples presented here.

Usage:

=qlBlackVarianceSurface(<ObjPrefix>,
                        <SettlementDate>, <Calendar>,
                        <Dates>, <Strikes>, <Volatilities>,
                        <DayCounter>)
<ObjPrefix>

Optional prefix for names of objects created with this function

<SettlementDate>

Reference date to which the volatility is zero

<Calendar>

Calendar to use in the underlying term structure. Used to adjustment to a business day

<Dates>

Sequence of dates or maturities (e.g. “1Y”) specifying the times to which observed volatilities are supplied

<Strikes>

Sequence of strikes at which observed volatilities are supplied

<Volatilities>

Matrix of observed volatilities, arranged so that maturities run in columns and strikes run in rows. The number of columns must be same as length of <Dates> and number of rows the same as length of <Strikes>

<DayCounter>

The day counter to use for calculating the length of time to use to convert the user-supplied annualised volatility to actual volatility during an interval

Example usage:

0

1d

1w

1m

2m

3m

6m

1y

->

0

1d

1w

1m

2m

3m

6m

1y

0.8

0.05

0.04

0.04

0.05

0.05

0.05

0.05

->

0.8

0.05

0.04

0.04

0.05

0.05

0.05

0.05

0.9

0.04

3.5000000000000003E-2

3.5000000000000003E-2

0.04

0.04

0.04

0.04

->

0.9

0.04

3.5000000000000003E-2

3.5000000000000003E-2

0.04

0.04

0.04

0.04

1

0.03

0.03

0.03

0.04

0.04

0.04

0.04

->

1

0.03

0.03

0.03

0.04

0.04

0.04

0.04

1.1

0.04

3.5000000000000003E-2

3.5000000000000003E-2

0.04

0.04

0.05

0.05

->

1.1

0.04

3.5000000000000003E-2

3.5000000000000003E-2

0.04

0.04

0.05

0.05

1.2

0.05

0.04

0.04

0.05

0.05

0.05

0.05

->

1.2

0.05

0.04

0.04

0.05

0.05

0.05

0.05

=qlBlackVarianceSurface(,”0D”, “TARGET”, R[-6]C[1]:R[-6]C[7],R[-5]C:R[-1]C,R[-5]C[1]:R[-1]C[7])

nil

nil

nil

nil

nil

nil

nil

->

obj_00008#0001

nil

nil

nil

nil

nil

nil

nil