ExpiryKVolMatrix





http://www.QuantTools.com
CapeTools Volatility Curves function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



Creates a volatility matrix.

Rows are option maturities (in tenor format), columns are strikes values.

You must decorate the volatility matrix with header and row information.

Row headers are option Maturity tenors from the calculation date, Column headers are strike values.

This type of Volatility Matrix is best used when you are considering one underlying only (ie 5 year swap).

Thus this would be the volatility values for different option maturities and strikes for the 5 year swap.

You thus enter within the 'UndTenor' parameter the underlying instrument.

You also indicate via the 'DepoIndex' (for a deposit underlying) and 'Swap Index' (for a swap underlying) parameters the details of this underlying tenor.

Based on the tenor entered (deposit type (ie - 3M) or swap type (ie - 5Y), the correct information will be retrieved.

This information will be used during risk management process (see the CapeTools IR Risk category of functions).



This function creates an object and returns a string-key value to represent this created object.
The TAG value of the string-key returned (second part of the key) is : "XKVM"



Note: Within Excel, the function is named - CT.CRV.ExpiryKVolMatrix




High level graphic of ExpiryKVolMatrix() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. Key parameter

    Key value to use as a handle for the created object
  2. Reload parameter

    When creating this object for the first time, set this parameter to a positive value. Within Excel, when re-computing a worksheet where you do not wish to recreate the object, set this parameter to zero (0).
  3. CurveName parameter

    A tag used to identify this curve (case insensitive) if placed within a Volatility curve collection ( via the GroupedVolCurves() function ). If you pass in an empty string, it will default to the name of the 'Key' parameter.
  4. ValueDate parameter

    Key to an already created Valuation Date Object. (Via the ValueDateObj() function).
  5. SettleDays parameter

    Number of days between the Exercise date of the options and the STARTDATE of the instrument.
  6. volRange parameter

    A matrix of volatility values including header information.
  7. DivideVolBy100 parameter

    Is the input volatility entered as a percentage value (true), or the raw volatility value (false). If entered as a percentage, the value will be divided by 100.0 internally.
  8. UndTenor parameter

    The actual underlying that the Volatility matrix represents.
  9. DepoIndex parameter

    Deposit (Libor) Index Template Key. (Created via the CreateDepoTemplate() function). If the Tenor entered into the 'UndTenor' parameter is of a FRA type tenor (duration of less than a year), then the definition of the instrument is defined via this parameter otherwise the definition of the 'SwapIndex' parameter will be used. This is the minimum definition of an interest rate index ( ie - LIBOR ). The definition of the index underlying a cap or floor structure instrument is defined via this template (minus the 'Tenor' information).
  10. SwapIndex parameter

    Swap Index Template Key. (Created via the CreateSwapTemplate() function). If the Tenor entered into the 'UndTenor' parameter is of a Swap type tenor (duration of more than a year), then the definition of the instrument is defined via this parameter otherwise just the definition of the 'DepoIndex' parameter will be used. This object provides the minimum definition of an interest rate Swaption contract and is the one used by the curve.
  11. DayCount parameter

    DayCounter for converting dates into year fractions.
  12. InterpType parameter

    Interpolation method to use when interpolating the curve for vols, - LINEAR, LOGLINEAR, CUBIC.


Extended information

Function Syntax

VB Syntax


String CTVolatiltyCurves.ExpiryKVolMatrix( _
String Key, _
Long Reload, _
String CurveName, _
String ValueDate, _
Long SettleDays, _
Variant volRange, _
Boolean DivideVolBy100, _
String UndTenor, _
String DepoIndex, _
String SwapIndex, _
DayCountEnum DayCount, _
InterpEnum InterpType)


Excel Spreadsheet Syntax


=CT.CRV.ExpiryKVolMatrix(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell CurveName,
Excel String Cell ValueDate,
Excel Numeric Cell SettleDays,
XLRange volRange,
Excel Boolean Value Cell DivideVolBy100,
Excel String Cell UndTenor,
Excel String Cell DepoIndex,
Excel String Cell SwapIndex,
Excel String Cell DayCount,
Excel String Cell InterpType)


C++ Syntax


static std::string ExpiryKVolMatrix(
std::string Key,
long Reload,
std::string CurveName,
std::string ValueDate,
long SettleDays,
CTRangeDataCPP volRange,
bool DivideVolBy100,
std::string UndTenor,
std::string DepoIndex,
std::string SwapIndex,
DayCountEnum DayCount,
InterpEnum InterpType);


DotNET Syntax


System.String CTVolatiltyCurvesSA.ExpiryKVolMatrix(
System.String Key,
System.Int32 Reload,
System.String CurveName,
System.String ValueDate,
System.Int32 SettleDays,
CTRangeData volRange,
System.Boolean DivideVolBy100,
System.String UndTenor,
System.String DepoIndex,
System.String SwapIndex,
CTIEnums.DayCountEnum DayCount,
CTIEnums.InterpEnum InterpType);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
CurveNameStringFALSE
ValueDateStringTRUE
SettleDaysLongFALSE
volRangeRangeFALSE
DivideVolBy100BooleanFALSE
UndTenorStringFALSE
DepoIndexStringTRUE
SwapIndexStringTRUE
DayCountDayCountEnumFALSE
InterpTypeInterpEnumFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
KeyFALSEMyExpiryKVolMatrix
ReloadFALSE1
CurveNameTRUEMyExpiryKVolMatrix
ValueDateFALSEValueDateNAME.EXTTAG.TICKER (from a function call)
SettleDaysFALSE2
volRangeFALSEExpiryKVolMatrix_volRange_Range (creates a range object)
DivideVolBy100FALSEtrue
UndTenorFALSE5Y
DepoIndexFALSEDepoIndexNAME.EXTTAG.TICKER (from a function call)
SwapIndexFALSESwapIndexNAME.EXTTAG.TICKER (from a function call)
DayCountFALSE30360
InterpTypeTRUELINEAR


Example range for parameter : volRange

Within Excel, a range such as this can be passed directly into the volRange parameter.

Opt\Strike0.020.0250.030.0350.040.0450.050.0550.060.0650.07
3M21.3320.3319.5318.9318.5318.3318.5318.9319.5320.3321.33
6M21.2320.2319.4318.8318.4318.2318.4318.8319.4320.2321.23
9M21.2920.2919.4918.8918.4918.2918.4918.8919.4920.2921.29
12M21.3520.3519.5518.9518.5518.3518.5518.9519.5520.3521.35
2Y21.3720.3719.5718.9718.5718.3718.5718.9719.5720.3721.37
4Y21.3420.3419.5418.9418.5418.3418.5418.9419.5420.3421.34
6Y21.3720.3719.5718.9718.5718.3718.5718.9719.5720.3721.37
8Y21.3520.3519.5518.9518.5518.3518.5518.9519.5520.3521.35
10Y21.3720.3719.5718.9718.5718.3718.5718.9719.5720.3721.37
12Y21.420.419.61918.618.418.61919.620.421.4
14Y21.2520.2519.4518.8518.4518.2518.4518.8519.4520.2521.25
16Y21.3820.3819.5818.9818.5818.3818.5818.9819.5820.3821.38
18Y21.2920.2919.4918.8918.4918.2918.4918.8919.4920.2921.29
20Y21.2120.2119.4118.8118.4118.2118.4118.8119.4120.2121.21
22Y21.3320.3319.5318.9318.5318.3318.5318.9319.5320.3321.33

Example C# API usage for setting the range data for parameter : volRange



CTQL.CTRangeData ExpiryKVolMatrix_volRange = new CTQL.CTRangeData();

System.Text.StringBuilder ExpiryKVolMatrix_volRange_builder =
new System.Text.StringBuilder(100);

ExpiryKVolMatrix_volRange_builder.Append("{");
ExpiryKVolMatrix_volRange_builder.Append("'Opt\\Strike'	 | 0.02	 | 0.025	 | 0.03	 | 0.035	 | 0.04	 | 0.045	 | 0.05	 | 0.055	 | 0.06	 | 0.065	 | 0.07 ;");
ExpiryKVolMatrix_volRange_builder.Append("'3M'	 | 21.33	 | 20.33	 | 19.53	 | 18.93	 | 18.53	 | 18.33	 | 18.53	 | 18.93	 | 19.53	 | 20.33	 | 21.33 ;");
ExpiryKVolMatrix_volRange_builder.Append("'6M'	 | 21.23	 | 20.23	 | 19.43	 | 18.83	 | 18.43	 | 18.23	 | 18.43	 | 18.83	 | 19.43	 | 20.23	 | 21.23 ;");
ExpiryKVolMatrix_volRange_builder.Append("'9M'	 | 21.29	 | 20.29	 | 19.49	 | 18.89	 | 18.49	 | 18.29	 | 18.49	 | 18.89	 | 19.49	 | 20.29	 | 21.29 ;");
ExpiryKVolMatrix_volRange_builder.Append("'12M'	 | 21.35	 | 20.35	 | 19.55	 | 18.95	 | 18.55	 | 18.35	 | 18.55	 | 18.95	 | 19.55	 | 20.35	 | 21.35 ;");
ExpiryKVolMatrix_volRange_builder.Append("'2Y'	 | 21.37	 | 20.37	 | 19.57	 | 18.97	 | 18.57	 | 18.37	 | 18.57	 | 18.97	 | 19.57	 | 20.37	 | 21.37 ;");
ExpiryKVolMatrix_volRange_builder.Append("'4Y'	 | 21.34	 | 20.34	 | 19.54	 | 18.94	 | 18.54	 | 18.34	 | 18.54	 | 18.94	 | 19.54	 | 20.34	 | 21.34 ;");
ExpiryKVolMatrix_volRange_builder.Append("'6Y'	 | 21.37	 | 20.37	 | 19.57	 | 18.97	 | 18.57	 | 18.37	 | 18.57	 | 18.97	 | 19.57	 | 20.37	 | 21.37 ;");
ExpiryKVolMatrix_volRange_builder.Append("'8Y'	 | 21.35	 | 20.35	 | 19.55	 | 18.95	 | 18.55	 | 18.35	 | 18.55	 | 18.95	 | 19.55	 | 20.35	 | 21.35 ;");
ExpiryKVolMatrix_volRange_builder.Append("'10Y'	 | 21.37	 | 20.37	 | 19.57	 | 18.97	 | 18.57	 | 18.37	 | 18.57	 | 18.97	 | 19.57	 | 20.37	 | 21.37 ;");
ExpiryKVolMatrix_volRange_builder.Append("'12Y'	 | 21.4	 | 20.4	 | 19.6	 | 19	 | 18.6	 | 18.4	 | 18.6	 | 19	 | 19.6	 | 20.4	 | 21.4 ;");
ExpiryKVolMatrix_volRange_builder.Append("'14Y'	 | 21.25	 | 20.25	 | 19.45	 | 18.85	 | 18.45	 | 18.25	 | 18.45	 | 18.85	 | 19.45	 | 20.25	 | 21.25 ;");
ExpiryKVolMatrix_volRange_builder.Append("'16Y'	 | 21.38	 | 20.38	 | 19.58	 | 18.98	 | 18.58	 | 18.38	 | 18.58	 | 18.98	 | 19.58	 | 20.38	 | 21.38 ;");
ExpiryKVolMatrix_volRange_builder.Append("'18Y'	 | 21.29	 | 20.29	 | 19.49	 | 18.89	 | 18.49	 | 18.29	 | 18.49	 | 18.89	 | 19.49	 | 20.29	 | 21.29 ;");
ExpiryKVolMatrix_volRange_builder.Append("'20Y'	 | 21.21	 | 20.21	 | 19.41	 | 18.81	 | 18.41	 | 18.21	 | 18.41	 | 18.81	 | 19.41	 | 20.21	 | 21.21 ;");
ExpiryKVolMatrix_volRange_builder.Append("'22Y'	 | 21.33	 | 20.33	 | 19.53	 | 18.93	 | 18.53	 | 18.33	 | 18.53	 | 18.93	 | 19.53	 | 20.33	 | 21.33");
ExpiryKVolMatrix_volRange_builder.Append("}");

// Parse the string into the Range object.
ExpiryKVolMatrix_volRange.RangeFromStr( ExpiryKVolMatrix_volRange_builder.ToString() );



Example function usage


The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.

The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the C# example.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.Curves20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the ExpiryKVolMatrix() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.

These are the financial QuantTools sub-function calls that are used within the examples :





The objects generated by these sub-functions are inter-connected in the following way :




The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the ExpiryKVolMatrix() function call


MyExpiryKVolMatrix_7.XKVM.0

Copyright (c) 2003-2007 CapeTools - All Rights Reserved.