ATMVolMatrix





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 ATM volatility matrix.

Rows are option maturities (in tenors format), columns are Underlying lengths (Tenor format).

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

Row headers are option Maturity tenors from the calculation date, Column headers are Underlying length values (Tenor format).

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

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 : "ATMVM"



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




High level graphic of ATMVolMatrix() 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 (in percent - ie 20.0, indicating 20%) including header information. The Header row vector represents Option maturity (a typical example of a possible value within this vector may be 3M indicating an option starting in 3 months), the header columns represent Underlying length (ie a typical example of an element within this vector would be 5Y, for a 5 year swap). Together (3M, 5Y), this point in the matrix will represent the volatility of a 5Y swap starting in 3M.
  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. DepoIndex parameter

    Deposit (Libor) Index Template Key. (Created via the CreateDepoTemplate() function). This is the minimum definition of an interest rate index ( ie - LIBOR ) and is the one used by the curve. The definition of the index underlying a cap or floor structure instrument is defined via this template (minus the 'Tenor' information).
  9. SwapIndex parameter

    Swap Index Template Key. (Created via the CreateSwapTemplate() function). This object provides the minimum definition of an interest rate Swap and is the one used by the curve. If this curve allows for Swap type instrument as the underlyings (via Tenors) as inputs, then the definition of those instruments are specified via this template.
  10. DayCount parameter

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

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


Extended information

Function Syntax

VB Syntax


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


Excel Spreadsheet Syntax


=CT.CRV.ATMVolMatrix(
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 DepoIndex,
Excel String Cell SwapIndex,
Excel String Cell DayCount,
Excel String Cell InterpType)


C++ Syntax


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


DotNET Syntax


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

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
CurveNameStringFALSE
ValueDateStringTRUE
SettleDaysLongFALSE
volRangeRangeFALSE
DivideVolBy100BooleanFALSE
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
KeyFALSEMyATMVolMatrix
ReloadFALSE1
CurveNameTRUEMyATMVolMatrix
ValueDateFALSEValueDateNAME.EXTTAG.TICKER (from a function call)
SettleDaysFALSE2
volRangeFALSEATMVolMatrix_volRange_Range (creates a range object)
DivideVolBy100FALSEtrue
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\Und3M6M9M12M2Y4Y6Y8Y10Y12Y14Y16Y
3M2020.0120.0120.0220.0320.0420.0520.0520.0620.0720.0820.09
6M20.0920.120.1120.1120.1220.1320.1420.1420.1520.1620.1720.18
9M20.1920.1920.220.2120.2220.2220.2320.2420.2520.2620.2720.27
12M20.2820.2920.2920.320.320.3120.3220.3320.3320.3420.3520.36
2Y20.3720.3720.3820.3920.420.4120.4120.4220.4320.4420.4520.46
4Y20.4720.4720.4820.4920.520.520.5120.5120.5220.5320.5320.54
6Y20.5520.5620.5620.5720.5820.5920.5920.620.6120.6120.6220.63
8Y20.6420.6420.6520.6620.6620.6720.6820.6920.6920.720.7120.72
10Y20.7220.7320.7420.7420.7520.7620.7720.7720.7820.7920.820.81
12Y20.8120.8220.8320.8320.8420.8520.8620.8620.8720.8820.8920.89
14Y20.920.9120.9220.9320.9320.9420.9520.9620.9720.9820.9820.99
16Y2121.0121.0221.0321.0321.0421.0521.0521.0621.0721.0821.08
18Y21.0921.121.121.1121.1221.1321.1421.1421.1521.1521.1621.17
20Y21.1721.1821.1921.221.2121.2121.2221.2321.2321.2421.2421.25
22Y21.2621.2621.2721.2821.2921.2921.321.3121.3221.3221.3321.34

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



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

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

ATMVolMatrix_volRange_builder.Append("{");
ATMVolMatrix_volRange_builder.Append("'Opt\\Und'	 | '3M'	 | '6M'	 | '9M'	 | '12M'	 | '2Y'	 | '4Y'	 | '6Y'	 | '8Y'	 | '10Y'	 | '12Y'	 | '14Y'	 | '16Y' ;");
ATMVolMatrix_volRange_builder.Append("'3M'	 | 20	 | 20.01	 | 20.01	 | 20.02	 | 20.03	 | 20.04	 | 20.05	 | 20.05	 | 20.06	 | 20.07	 | 20.08	 | 20.09 ;");
ATMVolMatrix_volRange_builder.Append("'6M'	 | 20.09	 | 20.1	 | 20.11	 | 20.11	 | 20.12	 | 20.13	 | 20.14	 | 20.14	 | 20.15	 | 20.16	 | 20.17	 | 20.18 ;");
ATMVolMatrix_volRange_builder.Append("'9M'	 | 20.19	 | 20.19	 | 20.2	 | 20.21	 | 20.22	 | 20.22	 | 20.23	 | 20.24	 | 20.25	 | 20.26	 | 20.27	 | 20.27 ;");
ATMVolMatrix_volRange_builder.Append("'12M'	 | 20.28	 | 20.29	 | 20.29	 | 20.3	 | 20.3	 | 20.31	 | 20.32	 | 20.33	 | 20.33	 | 20.34	 | 20.35	 | 20.36 ;");
ATMVolMatrix_volRange_builder.Append("'2Y'	 | 20.37	 | 20.37	 | 20.38	 | 20.39	 | 20.4	 | 20.41	 | 20.41	 | 20.42	 | 20.43	 | 20.44	 | 20.45	 | 20.46 ;");
ATMVolMatrix_volRange_builder.Append("'4Y'	 | 20.47	 | 20.47	 | 20.48	 | 20.49	 | 20.5	 | 20.5	 | 20.51	 | 20.51	 | 20.52	 | 20.53	 | 20.53	 | 20.54 ;");
ATMVolMatrix_volRange_builder.Append("'6Y'	 | 20.55	 | 20.56	 | 20.56	 | 20.57	 | 20.58	 | 20.59	 | 20.59	 | 20.6	 | 20.61	 | 20.61	 | 20.62	 | 20.63 ;");
ATMVolMatrix_volRange_builder.Append("'8Y'	 | 20.64	 | 20.64	 | 20.65	 | 20.66	 | 20.66	 | 20.67	 | 20.68	 | 20.69	 | 20.69	 | 20.7	 | 20.71	 | 20.72 ;");
ATMVolMatrix_volRange_builder.Append("'10Y'	 | 20.72	 | 20.73	 | 20.74	 | 20.74	 | 20.75	 | 20.76	 | 20.77	 | 20.77	 | 20.78	 | 20.79	 | 20.8	 | 20.81 ;");
ATMVolMatrix_volRange_builder.Append("'12Y'	 | 20.81	 | 20.82	 | 20.83	 | 20.83	 | 20.84	 | 20.85	 | 20.86	 | 20.86	 | 20.87	 | 20.88	 | 20.89	 | 20.89 ;");
ATMVolMatrix_volRange_builder.Append("'14Y'	 | 20.9	 | 20.91	 | 20.92	 | 20.93	 | 20.93	 | 20.94	 | 20.95	 | 20.96	 | 20.97	 | 20.98	 | 20.98	 | 20.99 ;");
ATMVolMatrix_volRange_builder.Append("'16Y'	 | 21	 | 21.01	 | 21.02	 | 21.03	 | 21.03	 | 21.04	 | 21.05	 | 21.05	 | 21.06	 | 21.07	 | 21.08	 | 21.08 ;");
ATMVolMatrix_volRange_builder.Append("'18Y'	 | 21.09	 | 21.1	 | 21.1	 | 21.11	 | 21.12	 | 21.13	 | 21.14	 | 21.14	 | 21.15	 | 21.15	 | 21.16	 | 21.17 ;");
ATMVolMatrix_volRange_builder.Append("'20Y'	 | 21.17	 | 21.18	 | 21.19	 | 21.2	 | 21.21	 | 21.21	 | 21.22	 | 21.23	 | 21.23	 | 21.24	 | 21.24	 | 21.25 ;");
ATMVolMatrix_volRange_builder.Append("'22Y'	 | 21.26	 | 21.26	 | 21.27	 | 21.28	 | 21.29	 | 21.29	 | 21.3	 | 21.31	 | 21.32	 | 21.32	 | 21.33	 | 21.34");
ATMVolMatrix_volRange_builder.Append("}");

// Parse the string into the Range object.
ATMVolMatrix_volRange.RangeFromStr( ATMVolMatrix_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 ATMVolMatrix() 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 ATMVolMatrix() function call


MyATMVolMatrix_6.ATMVM.0

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