CreateIndex





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

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

Key TAGs | Excel Index | API Index



Creates a new Index code.

This Index holds most of the information to determine the fixing value of an one-period FLOAT leg of interest rate deal.

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



Note: Within Excel, the function is named - CT.IDX.CreateIndex




High level graphic of CreateIndex() 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. IndexCode parameter

    New Index code to create
  4. Tenor parameter

    Tenor of the index.
  5. LIBORMethod parameter

    Within a Floating leg object, where there are many fixing periods, when fixing a rate there are two ways the end date of a fixing period can be computed. Either 'LIBOR' or 'ParCoupon'. The 'LIBOR' method ignores the end date of the period and computes the end date by adding on the Frequency length (value within the 'Tenor' parameter of this object) to the start date of the period. The 'ParCoupon' method uses the period end date. When this Index is passed to such a floating leg object, this flag informs the floating leg object of which method to use. However for In-Arrear or CMS type legs, the 'LIBOR' method is always used.
  6. FixingDays parameter

    Number of days for fixing a rate.
  7. Ccy parameter

    Currency code in which default values will be copied
  8. fixCalendar parameter

    Calendar Key required for holiday adjustments. Used for the computation of rate fixing dates.
  9. payCalendar parameter

    Calendar Key required for holiday adjustments. Required for the determination of the index's payment date. The payment date will actually be determined by combining the 'Fixing' calendar with the 'Payment' calendar so you do not need to use the MergeCalendars() function unless your payment calendar contains more than one calendar (not including the fixing calendar).
  10. BusDayConv parameter

    Business day convention needed for day adjustments when an adjustment moves the date into the preceding, following month.
  11. DayCounter parameter

    Daycounter required for year length calculations.
  12. BasisSwaps parameter

    An optional 2 or 3 column range of interest rate basis swap tenors and spreads. The third column is an optional boolean column as to whether the basis spread is to be used within the building of this index. The basis spread defined within this index is the basis swap spread between this index and the index (or more rather the deposit template) stored within the yieldCurve object (ie '3M Index' (this index) vs '6M YieldCurve Index' (via the curve's DepositTemplate object) ). This Basis Swap range is required as well as the value within the 'SpreadInterp' parameter if you wish to price basis swaps where there is a spread in order to entice buyers/sellers to trade with this index instead of the default (popular) index stored within the YieldCurve object (via the yieldcurve's Deposit Template
    object, created by the CreateDepoTemplate() function). There are numerous functions for pricing Basis Swaps and portfolio of Basis Swaps ( see BasisSwap() and BasisSwapPortfolio() ). If you do not wish to price basis swaps with this index, simply provide an empty range object (or leave blank in the case of Excel) to the 'BasisSwaps' parameter. Providing a basis swap curve of zeros (0.0), is not the same as providing an empty range because if the definition of this index object and the index within the yieldcurve differs by more than just the Tenor (ie - Business day convention , Calendar, LIBORMethod etc...) then this index will generate a non-zero forward spread curve and thus the FRA rates computed
    via this index will be affected.
  13. SpreadInterp parameter

    Interpolation methodology to utilise when interpolating the forward spread curve (generated from the interest basis swaps). Possible values are : 'BackStep', (for a flat interpolation in the backwards direction), 'ForwardStep', (for a flat interpolation in the forwards direction), 'Linear' or 'LogLinear'.
  14. PastFixings parameter

    Optional past fixings range.
  15. YCKey parameter

    Key to an already constructed YieldCurve object. This curve will be used to extract forward rates based on the details of this Indexes parameters.


Extended information

Function Syntax

VB Syntax


String CTIndexes.CreateIndex( _
String Key, _
Long Reload, _
String IndexCode, _
String Tenor, _
Boolean LIBORMethod, _
Long FixingDays, _
CCYEnum Ccy, _
String fixCalendar, _
String payCalendar, _
BDCEnum BusDayConv, _
DayCountEnum DayCounter, _
Variant BasisSwaps, _
InterpEnum SpreadInterp, _
Variant PastFixings, _
String YCKey)


Excel Spreadsheet Syntax


=CT.IDX.CreateIndex(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell IndexCode,
Excel String Cell Tenor,
Excel Boolean Value Cell LIBORMethod,
Excel Numeric Cell FixingDays,
Excel String Cell Ccy,
Excel String Cell fixCalendar,
Excel String Cell payCalendar,
Excel String Cell BusDayConv,
Excel String Cell DayCounter,
XLRange BasisSwaps,
Excel String Cell SpreadInterp,
XLRange PastFixings,
Excel String Cell YCKey)


C++ Syntax


static std::string CreateIndex(
std::string Key,
long Reload,
std::string IndexCode,
std::string Tenor,
bool LIBORMethod,
long FixingDays,
CCYEnum Ccy,
std::string fixCalendar,
std::string payCalendar,
BDCEnum BusDayConv,
DayCountEnum DayCounter,
CTRangeDataCPP BasisSwaps,
InterpEnum SpreadInterp,
CTRangeDataCPP PastFixings,
std::string YCKey);


DotNET Syntax


System.String CTIndexesSA.CreateIndex(
System.String Key,
System.Int32 Reload,
System.String IndexCode,
System.String Tenor,
System.Boolean LIBORMethod,
System.Int32 FixingDays,
CTIEnums.CCYEnum Ccy,
System.String fixCalendar,
System.String payCalendar,
CTIEnums.BDCEnum BusDayConv,
CTIEnums.DayCountEnum DayCounter,
CTRangeData BasisSwaps,
CTIEnums.InterpEnum SpreadInterp,
CTRangeData PastFixings,
System.String YCKey);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
IndexCodeStringFALSE
TenorStringFALSE
LIBORMethodBooleanFALSE
FixingDaysLongFALSE
CcyCCYEnumFALSE
fixCalendarStringTRUE
payCalendarStringTRUE
BusDayConvBDCEnumFALSE
DayCounterDayCountEnumFALSE
BasisSwapsRangeFALSE
SpreadInterpInterpEnumFALSE
PastFixingsRangeFALSE
YCKeyStringTRUE


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
KeyFALSEMyNewIndex
ReloadFALSE1
IndexCodeFALSE3MEuroIndex1
TenorFALSE3M
LIBORMethodFALSEtrue
FixingDaysFALSE2
CcyFALSEEUR
fixCalendarFALSEfixCalendarNAME.EXTTAG.TICKER (from a function call)
payCalendarFALSEpayCalendarNAME.EXTTAG.TICKER (from a function call)
BusDayConvFALSEMonthEndReference
DayCounterFALSEACT365F
BasisSwapsTRUECreateIndex_BasisSwaps_Range (creates a range object)
SpreadInterpTRUEForwardStep
PastFixingsTRUECreateIndex_PastFixings_Range (creates a range object)
YCKeyFALSEYCKeyNAME.EXTTAG.TICKER (from a function call)


Example range for parameter : BasisSwaps

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

1Y3.5True
2Y3True
3Y3.25True
4Y3.25True
5Y3.25True
7Y3.25True
10Y3.25True
15Y3True
20Y2.75True
30Y2.75True

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



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

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

CreateIndex_BasisSwaps_builder.Append("{");
CreateIndex_BasisSwaps_builder.Append("'1Y'	 | 3.5	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'2Y'	 | 3	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'3Y'	 | 3.25	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'4Y'	 | 3.25	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'5Y'	 | 3.25	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'7Y'	 | 3.25	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'10Y'	 | 3.25	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'15Y'	 | 3	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'20Y'	 | 2.75	 | True ;");
CreateIndex_BasisSwaps_builder.Append("'30Y'	 | 2.75	 | True");
CreateIndex_BasisSwaps_builder.Append("}");

// Parse the string into the Range object.
CreateIndex_BasisSwaps.RangeFromStr( CreateIndex_BasisSwaps_builder.ToString() );


Example range for parameter : PastFixings

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

21/Mar/20050.0348
22/Mar/20050.035
23/Mar/20050.035
24/Mar/20050.0348
25/Mar/20050.035
28/Mar/20050.0351
29/Mar/20050.0349
30/Mar/20050.035
31/Mar/20050.0349
1/Apr/20050.0348
4/Apr/20050.035
5/Apr/20050.0348
6/Apr/20050.035
7/Apr/20050.0348
8/Apr/20050.0349
11/Apr/20050.0349
12/Apr/20050.035
13/Apr/20050.0352
14/Apr/20050.035
15/Apr/20050.0351
18/Apr/20050.035
19/Apr/20050.035
20/Apr/20050.0352
21/Apr/20050.035
22/Apr/20050.035
25/Apr/20050.0351
26/Apr/20050.035
27/Apr/20050.0348
28/Apr/20050.0352
29/Apr/20050.0351
2/May/20050.0349
3/May/20050.0351
4/May/20050.0348
5/May/20050.035
6/May/20050.035
9/May/20050.0349
10/May/20050.0351
11/May/20050.0352
12/May/20050.0349
13/May/20050.0351
16/May/20050.0351
17/May/20050.0349
18/May/20050.0352
19/May/20050.0352
20/May/20050.0351
23/May/20050.0349
24/May/20050.0349
25/May/20050.0351
26/May/20050.0351
27/May/20050.0352
30/May/20050.0352
31/May/20050.0349
1/Jun/20050.0351
2/Jun/20050.035
3/Jun/20050.0351
6/Jun/20050.035
7/Jun/20050.0351
8/Jun/20050.0349
9/Jun/20050.0352
10/Jun/20050.0351
13/Jun/20050.035
14/Jun/20050.0351
15/Jun/20050.0352
16/Jun/20050.035
17/Jun/20050.0349
20/Jun/20050.0349
21/Jun/20050.0351
22/Jun/20050.0349
23/Jun/20050.0349
24/Jun/20050.0351
27/Jun/20050.0351
28/Jun/20050.0352
29/Jun/20050.0351
30/Jun/20050.0349
1/Jul/20050.0349
4/Jul/20050.0348
5/Jul/20050.0348
6/Jul/20050.0349
7/Jul/20050.0351
8/Jul/20050.035
11/Jul/20050.0348
12/Jul/20050.0352
13/Jul/20050.035
14/Jul/20050.0351
15/Jul/20050.035

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



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

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

CreateIndex_PastFixings_builder.Append("{");
CreateIndex_PastFixings_builder.Append("#21/Mar/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#22/Mar/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#23/Mar/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#24/Mar/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#25/Mar/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#28/Mar/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#29/Mar/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#30/Mar/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#31/Mar/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#1/Apr/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#4/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#5/Apr/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#6/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#7/Apr/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#8/Apr/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#11/Apr/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#12/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#13/Apr/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#14/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#15/Apr/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#18/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#19/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#20/Apr/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#21/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#22/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#25/Apr/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#26/Apr/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#27/Apr/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#28/Apr/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#29/Apr/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#2/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#3/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#4/May/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#5/May/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#6/May/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#9/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#10/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#11/May/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#12/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#13/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#16/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#17/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#18/May/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#19/May/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#20/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#23/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#24/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#25/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#26/May/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#27/May/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#30/May/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#31/May/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#1/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#2/Jun/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#3/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#6/Jun/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#7/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#8/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#9/Jun/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#10/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#13/Jun/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#14/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#15/Jun/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#16/Jun/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#17/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#20/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#21/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#22/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#23/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#24/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#27/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#28/Jun/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#29/Jun/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#30/Jun/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#1/Jul/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#4/Jul/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#5/Jul/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#6/Jul/2005#	 | 0.0349 ;");
CreateIndex_PastFixings_builder.Append("#7/Jul/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#8/Jul/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#11/Jul/2005#	 | 0.0348 ;");
CreateIndex_PastFixings_builder.Append("#12/Jul/2005#	 | 0.0352 ;");
CreateIndex_PastFixings_builder.Append("#13/Jul/2005#	 | 0.035 ;");
CreateIndex_PastFixings_builder.Append("#14/Jul/2005#	 | 0.0351 ;");
CreateIndex_PastFixings_builder.Append("#15/Jul/2005#	 | 0.035");
CreateIndex_PastFixings_builder.Append("}");

// Parse the string into the Range object.
CreateIndex_PastFixings.RangeFromStr( CreateIndex_PastFixings_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 CreateIndex() 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 CreateIndex() function call


MyNewIndex_18.IDX.0

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