ZeroCurve2





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

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

Key TAGs | Excel Index | API Index



Creates a simple zero curve from FRA Tenors (or Dates) and zero rates.

The zero rates covers the period between today and the current tenor.

This curve can be used for retrieving forward rates, discount factors and zero rates.

Can also be used to price market instruments, deposits, futures, FRAs, CMS and Swap rates.

This function requires the input of a IndexKey template object key, which must have been produced via a call to CreateDepoTemplate(). This function would have returned a string 'KEY' which is to be passed to the 'DepoIndex' parameter of this function.

This function requires the input of a SWAP IndexKey template object key, which must have been produced via a call to CreateSwapTemplate(). This function would have returned a string 'KEY' which is to be passed to the 'Swap Index' parameter of this function.

This function requires the input of a Calendar object key, which must have been produced via a call to one of the Calendar creation functions present within the CapeTools Calendars category of functions.

These functions would have returned a string 'KEY' which is to be passed to the 'Cal' parameter of this function.

For the 'DayCount' and 'BusDayConv' parameters, please refer to the large number of enumeration functions present within the CapeTools Enums category of functions.

The CapeTools Enums category of functions return correct string codes that can be passed to parameters taking fixed string values defined by the library (ie - DayCount codes, frequency codes, currency codes, compounding codes, business day convention codes etc...).

You can thus execute these enumeration functions which return the proper code, instead of trying to remember the string code needed or making spelling mistakes which can be difficult to debug.



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



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




High level graphic of ZeroCurve2() 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 Yieldcurve collection ( via the GroupedCurves() 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. oTenorsVals parameter

    A 2 column range of Tenors (or Dates) and zero rates.
  6. DayCount parameter

    DayCounter for converting dates into year fractions.
  7. 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. If this curve allows Deposit or FRA instrument as inputs, then the definition of those instruments are specified via this template (minus the 'Tenor' information). In addition, if this curve is passed to an Index creation function ( functions within the 'CapeTools Indexes' category of functions) then this index will serve as the definition of one side of an interest rate BasisSwap transaction. Basically, provides the definition of a BasisSwap between this index template and the index defined by the index-creation function.
  8. 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 instrument as inputs, then the definition of those instruments are specified via this template. This object is also used by other functions when requesting a Swap rate without the underlying swap rate definition.
  9. Extrapolate parameter

    Whether the yieldCurve data should be extrapolated if a calculation request that uses a date that is beyond the end date of the yieldCurve (ie - a request for a 40 year discount factor, but the curve is only built up to 30 years.) If false an error will be returned. This setting is set globally for the whole curve. The extrapolation is conducted by computing a daily compounded forward rate between the last two points of the yieldcurve and then using this to estimate distant discount factor points.


Extended information

Function Syntax

VB Syntax


String CTCurves.ZeroCurve2( _
String Key, _
Long Reload, _
String CurveName, _
String ValueDate, _
Variant oTenorsVals, _
DayCountEnum DayCount, _
String DepoIndex, _
String SwapIndex, _
Boolean Extrapolate)


Excel Spreadsheet Syntax


=CT.CRV.ZeroCurve2(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell CurveName,
Excel String Cell ValueDate,
XLRange oTenorsVals,
Excel String Cell DayCount,
Excel String Cell DepoIndex,
Excel String Cell SwapIndex,
Excel Boolean Value Cell Extrapolate)


C++ Syntax


static std::string ZeroCurve2(
std::string Key,
long Reload,
std::string CurveName,
std::string ValueDate,
CTRangeDataCPP oTenorsVals,
DayCountEnum DayCount,
std::string DepoIndex,
std::string SwapIndex,
bool Extrapolate);


DotNET Syntax


System.String CTCurvesSA.ZeroCurve2(
System.String Key,
System.Int32 Reload,
System.String CurveName,
System.String ValueDate,
CTRangeData oTenorsVals,
CTIEnums.DayCountEnum DayCount,
System.String DepoIndex,
System.String SwapIndex,
System.Boolean Extrapolate);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
CurveNameStringFALSE
ValueDateStringTRUE
oTenorsValsRangeFALSE
DayCountDayCountEnumFALSE
DepoIndexStringTRUE
SwapIndexStringTRUE
ExtrapolateBooleanFALSE


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
KeyFALSEMyZeroCurve2
ReloadFALSE1
CurveNameTRUEMyZeroCurve2
ValueDateFALSEValueDateNAME.EXTTAG.TICKER (from a function call)
oTenorsValsFALSEZeroCurve2_oTenorsVals_Range (creates a range object)
DayCountFALSEACT365F
DepoIndexFALSEDepoIndexNAME.EXTTAG.TICKER (from a function call)
SwapIndexFALSESwapIndexNAME.EXTTAG.TICKER (from a function call)
ExtrapolateFALSEtrue


Example range for parameter : oTenorsVals

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

1M3.52True
2M3.54True
3M3.56True
4M3.57True
5M3.59True
6M3.61True
7M3.63True
8M3.64True
9M3.67True
10M3.69True
11M3.72True
2Y3.76True
3Y3.79True
4Y3.83True
5Y3.85True
6Y3.88True
7Y3.91True
8Y3.96True
9Y4.01True
10Y4.04True
11Y4.09True
12Y4.13True
13Y4.18True
14Y4.21True
15Y4.25True
16Y4.29True
17Y4.33True
18Y4.37True
19Y4.39True
20Y4.41True
21Y4.44True

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



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

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

ZeroCurve2_oTenorsVals_builder.Append("{");
ZeroCurve2_oTenorsVals_builder.Append("'1M'	 | 3.52	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'2M'	 | 3.54	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'3M'	 | 3.56	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'4M'	 | 3.57	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'5M'	 | 3.59	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'6M'	 | 3.61	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'7M'	 | 3.63	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'8M'	 | 3.64	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'9M'	 | 3.67	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'10M'	 | 3.69	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'11M'	 | 3.72	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'2Y'	 | 3.76	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'3Y'	 | 3.79	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'4Y'	 | 3.83	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'5Y'	 | 3.85	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'6Y'	 | 3.88	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'7Y'	 | 3.91	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'8Y'	 | 3.96	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'9Y'	 | 4.01	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'10Y'	 | 4.04	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'11Y'	 | 4.09	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'12Y'	 | 4.13	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'13Y'	 | 4.18	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'14Y'	 | 4.21	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'15Y'	 | 4.25	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'16Y'	 | 4.29	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'17Y'	 | 4.33	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'18Y'	 | 4.37	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'19Y'	 | 4.39	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'20Y'	 | 4.41	 | True ;");
ZeroCurve2_oTenorsVals_builder.Append("'21Y'	 | 4.44	 | True");
ZeroCurve2_oTenorsVals_builder.Append("}");

// Parse the string into the Range object.
ZeroCurve2_oTenorsVals.RangeFromStr( ZeroCurve2_oTenorsVals_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 ZeroCurve2() 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 ZeroCurve2() function call


MyZeroCurve2_8.ZYC2.0

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