CreateFIXFloatLeg





http://www.QuantTools.com
CapeTools FIXED + FLOAT Legs function list

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

Key TAGs | Excel Index | API Index



You can price this strategy with the PrcInverseLegObject() function.

The payoff for this leg is in fact the difference of two coupons.

The first a FIXED coupon rate, the second FLOAT rate.

Thus for each coupon period, the coupon rate computed will be either a FIXED INVERSE FLOATER LEG [X - N*L] or a FLOAT INVERSE FLOATER LEG [N*L - X], where N is a positive integer gearing amount.

N represents the 'FixingGearing' parameter within the function call.

X is the FIXED coupon rate and L is the floating rate fixing.

If you pass in a Swap Index instead of a Libor Index, the swap rate fixing will be adjusted for the unnatural payments via a constant maturity swap adjustment calculation.

This leg object can either be priced directly via the PrcLegObject() function or passed to the Swap2() function.

Finally there are numerous querying functions that can be applied to this leg (within the CapeTools Query Legs category of functions).

This function requires the input of a Schedule object key, which must have been produced via a call to one of the following functions : MakeSchedule() or MakeSchedule2(). These functions would have returned a string 'KEY' which is to be passed to the 'ScheduleKey' parameter of this function.

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

You can also execute the CreateSwapIndex(), IDXEURSwap(), IDXGBPSwap(), IDXJPYSwap(), IDXCHFSwap() or IDXUSDSwap() function in order to price a constant maturity swap leg, a CMS convexity adjustment will be applied to rate.

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

This function requires the input of an optional FXVolCurve object key, which must have been produced via a call to the FlatVolCurve() or VectorVolCurve() functions.

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

This function requires the input of an optional VOLFX correlation object key, which must have been produced via a call to the FlatVolFXCorr(), VectorVolFXCorr() or VolFXCorrMatrix() functions.

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

The latter two 'key' values are used for various convexity or Quanto adjustments that may be needed.

Please refer to the large number of enum 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 enum 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 : "FIXFLTLEG"



Note: Within Excel, the function is named - CT.LEG.CreateFIXFloatLeg




High level graphic of CreateFIXFloatLeg() 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 recomputing a worksheet where you do not wish to recreate the object, set this parameter to zero (0).
  3. PayRec parameter

    Whether you would like to PAY or REC this leg.
  4. InverseType parameter

    Whether you would like to structure a FIXED INVERSE FLOATER LEG [X - N*L] or a FLOAT INVERSE FLOATER LEG [N*L - X], where N is a positive gearing amount, X is the FIXED coupon rate and L is the fixing rate.
  5. FixingGearing parameter

    A positive factor value you wish to multiply the fixing (reset) rate by.
  6. Notional parameter

    A positive valued Notional amount of the deal. Can pass an array of notional amounts for each period
  7. PrincipalPayments parameter

    A positive valued Principal Payments array. Generally in the case where the 'Notional' parameter has been filled with amortised Notional values you indicate, within this array, the principal amounts that are to be paid to the holder of this contract during the life of the leg. In the case of amortised legs, this should be populated. The length of this array must equal the length of the 'Notional' parameter or be empty (if you are not concerned with providing Principal Payments).
  8. Ccy parameter

    Currency of the Notional amount.
  9. ScheduleKey parameter

    Schedule Key to an already generated schedule object.
  10. BusDayConv parameter

    Payment Business Day Convention. Treatment of date calculations for (discounting).
  11. DayCount parameter

    Payment DayCounter. Used for the calculation of year periods regarding payment (discounting).
  12. Coupon parameter

    Coupon amount to be received/paid, can pass in an array of coupons, each coupon corresponds to a cashflow of the generated schedule..
  13. IndexKey parameter

    KEY to an already constructed Index object. This index contains the fixing (reset) curve.
  14. Margin parameter

    Margin amount to add onto the computed fixing/forward rate, can pass in an array of margins.
  15. ExchangePrincipal parameter

    Whether you wish to exchange the principal amount(s) at the start and termination of the leg contract.
  16. MKTKey parameter

    Key to an already constructed MKT object that contains at least a discounting curve. The VolCurve should be present if pricing CMS or In-Arrear legs, deals. The curves contained within this object should all be of the same Currency of which must equal the value of the 'Ccy' parameter of this function.
  17. SMPFWDRho parameter

    If a CMS index is specified (within the parameter 'IndexKey') and the 'CMSAlgo' parameter within this CMS Index has been set to 'Hull' then the correlation between swap rates and fwd rates is required.


Extended information

Function Syntax

VB Syntax


String CTFIXFLTLegs.CreateFIXFloatLeg( _
String Key, _
Long Reload, _
PAYRECEnum PayRec, _
INVTYPEEnum InverseType, _
Long FixingGearing, _
Variant Notional, _
Variant PrincipalPayments, _
CCYEnum Ccy, _
String ScheduleKey, _
BDCEnum BusDayConv, _
DayCountEnum DayCount, _
Variant Coupon, _
String IndexKey, _
Variant Margin, _
Boolean ExchangePrincipal, _
String MKTKey, _
Double SMPFWDRho)


Excel Spreadsheet Syntax


=CT.LEG.CreateFIXFloatLeg(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell PayRec,
Excel String Cell InverseType,
Excel Numeric Cell FixingGearing,
XLRange Notional,
XLRange PrincipalPayments,
Excel String Cell Ccy,
Excel String Cell ScheduleKey,
Excel String Cell BusDayConv,
Excel String Cell DayCount,
XLRange Coupon,
Excel String Cell IndexKey,
XLRange Margin,
Excel Boolean Value Cell ExchangePrincipal,
Excel String Cell MKTKey,
Excel Numeric Cell SMPFWDRho)


C++ Syntax


static std::string CreateFIXFloatLeg(
std::string Key,
long Reload,
PAYRECEnum PayRec,
INVTYPEEnum InverseType,
long FixingGearing,
CTRangeDataCPP Notional,
CTRangeDataCPP PrincipalPayments,
CCYEnum Ccy,
std::string ScheduleKey,
BDCEnum BusDayConv,
DayCountEnum DayCount,
CTRangeDataCPP Coupon,
std::string IndexKey,
CTRangeDataCPP Margin,
bool ExchangePrincipal,
std::string MKTKey,
double SMPFWDRho);


DotNET Syntax


System.String CTFIXFLTLegsSA.CreateFIXFloatLeg(
System.String Key,
System.Int32 Reload,
CTIEnums.PAYRECEnum PayRec,
CTIEnums.INVTYPEEnum InverseType,
System.Int32 FixingGearing,
CTRangeData Notional,
CTRangeData PrincipalPayments,
CTIEnums.CCYEnum Ccy,
System.String ScheduleKey,
CTIEnums.BDCEnum BusDayConv,
CTIEnums.DayCountEnum DayCount,
CTRangeData Coupon,
System.String IndexKey,
CTRangeData Margin,
System.Boolean ExchangePrincipal,
System.String MKTKey,
System.Double SMPFWDRho);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
PayRecPAYRECEnumFALSE
InverseTypeINVTYPEEnumFALSE
FixingGearingLongFALSE
NotionalRangeFALSE
PrincipalPaymentsRangeFALSE
CcyCCYEnumFALSE
ScheduleKeyStringTRUE
BusDayConvBDCEnumFALSE
DayCountDayCountEnumFALSE
CouponRangeFALSE
IndexKeyStringTRUE
MarginRangeFALSE
ExchangePrincipalBooleanFALSE
MKTKeyStringTRUE
SMPFWDRhoDoubleFALSE


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
KeyFALSEMyCreateFIXFloatLeg
ReloadFALSE1
PayRecFALSEPAY
InverseTypeFALSEFIX
FixingGearingFALSE1
NotionalFALSECreateFIXFloatLeg_Notional_Range (creates a range object)
PrincipalPaymentsTRUECreateFIXFloatLeg_PrincipalPayments_Range (creates a range object)
CcyFALSEEUR
ScheduleKeyFALSEScheduleKeyNAME.EXTTAG.TICKER (from a function call)
BusDayConvFALSEModifiedFollowing
DayCountFALSEACT365
CouponTRUECreateFIXFloatLeg_Coupon_Range (creates a range object)
IndexKeyFALSEIndexKeyNAME.EXTTAG.TICKER (from a function call)
MarginTRUECreateFIXFloatLeg_Margin_Range (creates a range object)
ExchangePrincipalFALSEfalse
MKTKeyFALSEMKTKeyNAME.EXTTAG.TICKER (from a function call)
SMPFWDRhoTRUE0.8


Example range for parameter : Notional

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


Data is stored within the second column (Vector of data)..

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



CTQL.CTRangeData CreateFIXFloatLeg_Notional;


int[] arrBCreateFIXFloatLeg_Notional = {
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000,
5000000  //  Array Data

};

CTQL.IntVector arrCreateFIXFloatLeg_Notional =
new  CTQL.IntVector(arrBCreateFIXFloatLeg_Notional);

// Second parameter determines whether the array is a column array (false) or a row array (true)
CreateFIXFloatLeg_Notional = new  CTQL.CTRangeData(arrCreateFIXFloatLeg_Notional, false);


Example range for parameter : PrincipalPayments

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


Data is stored within the second column (Vector of data)..

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



CTQL.CTRangeData CreateFIXFloatLeg_PrincipalPayments;


int[] arrBCreateFIXFloatLeg_PrincipalPayments = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0  //  Array Data

};

CTQL.IntVector arrCreateFIXFloatLeg_PrincipalPayments =
new  CTQL.IntVector(arrBCreateFIXFloatLeg_PrincipalPayments);

// Second parameter determines whether the array is a column array (false) or a row array (true)
CreateFIXFloatLeg_PrincipalPayments = new  CTQL.CTRangeData(arrCreateFIXFloatLeg_PrincipalPayments, false);


Example range for parameter : Coupon

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


Data is stored within the second column (Vector of data)..

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



CTQL.CTRangeData CreateFIXFloatLeg_Coupon;


double[] arrBCreateFIXFloatLeg_Coupon = {
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05  //  Array Data

};

CTQL.DoubleVector arrCreateFIXFloatLeg_Coupon =
new  CTQL.DoubleVector(arrBCreateFIXFloatLeg_Coupon);

// Second parameter determines whether the array is a column array (false) or a row array (true)
CreateFIXFloatLeg_Coupon = new  CTQL.CTRangeData(arrCreateFIXFloatLeg_Coupon, false);


Example range for parameter : Margin

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


Data is stored within the second column (Vector of data)..

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



CTQL.CTRangeData CreateFIXFloatLeg_Margin;


double[] arrBCreateFIXFloatLeg_Margin = {
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002,
0.0002  //  Array Data

};

CTQL.DoubleVector arrCreateFIXFloatLeg_Margin =
new  CTQL.DoubleVector(arrBCreateFIXFloatLeg_Margin);

// Second parameter determines whether the array is a column array (false) or a row array (true)
CreateFIXFloatLeg_Margin = new  CTQL.CTRangeData(arrCreateFIXFloatLeg_Margin, false);



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.IRLegs20 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 CreateFIXFloatLeg() 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 CreateFIXFloatLeg() function call


MyCreateFIXFloatLeg_1.FIXFLTLEG.0

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