GenericLMM_MCPricer





http://www.QuantTools.com
CapeTools Generic IR LMM MonteCarlo Pricer function list

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

Key TAGs | Excel Index | API Index



Creates a generic pricing monte carlo object given a process object and a pricing grid.

The pricing Grid defines the payoff of your generic deal.

Rows represent events that you can attach event information to.

The columns are where one attaches this information.

The first column of the PayOff table contains the mandatory dates (or event dates).

These are the dates that you wish to attach an event to.

The mandatory dates increase in value as you move down the table.

Thus the maturity of the deal will be represented by the final mandatory date within the table.

Even though you may only have, say 10 mandatory dates defined, the 'MinNoOfSteps' parameter may indicate that the timeline be split in 100 steps.

In this example there will be 100 steps in which you will only attach events to 10 of them.

From the second column onwards, you are free to define your payoff.

You can use as many columns as you require.

The final result will be obtained from the bottom right of the PayOff table, thus you must make sure that your formulas place the final formula expression within this cell.



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



Note: Within Excel, the function is named - CT.PRO.GenericLMM_MCPricer




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

    Key to an already constructed Libor Market Model (LMM) process object.
  4. PayOffTable parameter

    PayOff table. The number of rows has to equal the number of timepoints (within the Mandatory Dates column (first column) within the PayOff table).
  5. ValidateDates parameter

    With the PayOff table, the first column represents event dates. These events dates should correspond the the start dates of the underlying 'Leg' object passed into the LMM Process object. These dates are not used within this function and are present to aid in the construction of the PayOff table. However if you wish to have these dates verified against the Start dates array within the 'Leg' object, set this parameter to true.
  6. NoOfSims parameter

    The number of simulations.
  7. ConstParams parameter

    An optional two column table of variables/values. The name given to these variables (must start with an underscore character) can be referenced within the PayOff table formulas.
  8. Interp1D_1 parameter

    An optional 1D Interpolation Object. You can refer to this function within the PayOff table as Interp1D(1, XValue)
  9. Interp1D_2 parameter

    A second optional 1D Interpolation Object. You can refer to this function within the PayOff table as Interp1D(2, XValue)
  10. Interp2D_1 parameter

    An optional 2D Interpolation Object. You can refer to this function within the PayOff table as Interp2D(1, XValue, YValue)
  11. Interp2D_2 parameter

    A second optional 2D Interpolation Object. You can refer to this function within the PayOff table as Interp2D(2, XValue, YValue)


Extended information

Function Syntax

VB Syntax


String CTLMMMCPricer.GenericLMM_MCPricer( _
String Key, _
Long Reload, _
String LMMGenerator, _
Variant PayOffTable, _
Boolean ValidateDates, _
Long NoOfSims, _
Variant ConstParams, _
String Interp1D_1, _
String Interp1D_2, _
String Interp2D_1, _
String Interp2D_2)


Excel Spreadsheet Syntax


=CT.PRO.GenericLMM_MCPricer(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell LMMGenerator,
XLRange PayOffTable,
Excel Boolean Value Cell ValidateDates,
Excel Numeric Cell NoOfSims,
XLRange ConstParams,
Excel String Cell Interp1D_1,
Excel String Cell Interp1D_2,
Excel String Cell Interp2D_1,
Excel String Cell Interp2D_2)


C++ Syntax


static std::string GenericLMM_MCPricer(
std::string Key,
long Reload,
std::string LMMGenerator,
CTRangeDataCPP PayOffTable,
bool ValidateDates,
long NoOfSims,
CTRangeDataCPP ConstParams,
std::string Interp1D_1,
std::string Interp1D_2,
std::string Interp2D_1,
std::string Interp2D_2);


DotNET Syntax


System.String CTLMMMCPricerSA.GenericLMM_MCPricer(
System.String Key,
System.Int32 Reload,
System.String LMMGenerator,
CTRangeData PayOffTable,
System.Boolean ValidateDates,
System.Int32 NoOfSims,
CTRangeData ConstParams,
System.String Interp1D_1,
System.String Interp1D_2,
System.String Interp2D_1,
System.String Interp2D_2);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
LMMGeneratorStringTRUE
PayOffTableRangeFALSE
ValidateDatesBooleanFALSE
NoOfSimsLongFALSE
ConstParamsRangeFALSE
Interp1D_1StringTRUE
Interp1D_2StringTRUE
Interp2D_1StringTRUE
Interp2D_2StringTRUE


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
KeyFALSEMyGenericLMM_MCPricer
ReloadFALSE1
LMMGeneratorFALSELMMGeneratorNAME.EXTTAG.TICKER (from a function call)
PayOffTableFALSEGenericLMM_MCPricer_PayOffTable_Range (creates a range object)
ValidateDatesFALSEfalse
NoOfSimsFALSE10
ConstParamsTRUEGenericLMM_MCPricer_ConstParams_Range (creates a range object)
Interp1D_1TRUEInterp1D_1NAME.EXTTAG.TICKER (from a function call)
Interp1D_2TRUEInterp1D_2NAME.EXTTAG.TICKER (from a function call)
Interp2D_1TRUEInterp2D_1NAME.EXTTAG.TICKER (from a function call)
Interp2D_2TRUEInterp2D_2NAME.EXTTAG.TICKER (from a function call)


Example range for parameter : PayOffTable

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

21/Jul/2006
23/Oct/2006Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
22/Jan/2007Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
23/Apr/2007Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
23/Jul/2007Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
22/Oct/2007Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jan/2008Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Apr/2008Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jul/2008Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Oct/2008Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jan/2009Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Apr/2009Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jul/2009Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Oct/2009Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jan/2010Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Apr/2010Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jul/2010Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Oct/2010Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jan/2011Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Apr/2011Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)
21/Jul/2011Libor(cRow) + _aInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(GridColMin(cCol-1, 1, cRow) - LiborMin(1, cRow), 0.0) * DCF(cRow) * Cvg(cRow)

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



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

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

GenericLMM_MCPricer_PayOffTable_builder.Append("{");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jul/2006#	 | 	 | 	 | 	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#23/Oct/2006#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#22/Jan/2007#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#23/Apr/2007#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#23/Jul/2007#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#22/Oct/2007#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jan/2008#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Apr/2008#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jul/2008#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Oct/2008#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jan/2009#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Apr/2009#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jul/2009#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Oct/2009#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jan/2010#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Apr/2010#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jul/2010#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Oct/2010#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jan/2011#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Apr/2011#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 |  ;");
GenericLMM_MCPricer_PayOffTable_builder.Append("#21/Jul/2011#	 | Libor(cRow) + _a	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(GridColMin(cCol-1, 1, cRow) - LiborMin(1, cRow), 0.0) * DCF(cRow) * Cvg(cRow)");
GenericLMM_MCPricer_PayOffTable_builder.Append("}");

// Parse the string into the Range object.
GenericLMM_MCPricer_PayOffTable.RangeFromStr( GenericLMM_MCPricer_PayOffTable_builder.ToString() );


Example range for parameter : ConstParams

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

_a0.0001
_b20
_c2.5
_var140

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



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

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

GenericLMM_MCPricer_ConstParams_builder.Append("{");
GenericLMM_MCPricer_ConstParams_builder.Append("_a	 | 0.0001 ;");
GenericLMM_MCPricer_ConstParams_builder.Append("_b	 | 20 ;");
GenericLMM_MCPricer_ConstParams_builder.Append("_c	 | 2.5 ;");
GenericLMM_MCPricer_ConstParams_builder.Append("_var1	 | 40");
GenericLMM_MCPricer_ConstParams_builder.Append("}");

// Parse the string into the Range object.
GenericLMM_MCPricer_ConstParams.RangeFromStr( GenericLMM_MCPricer_ConstParams_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.GenericPricing20 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 GenericLMM_MCPricer() 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 GenericLMM_MCPricer() function call


MyGenericLMM_MCPricer_1.LMMMCGPricer.0

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