GenericTreePricer





http://www.QuantTools.com
CapeTools Generic Tree Pricer function list

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

Key TAGs | Excel Index | API Index



Creates a generic pricing tree 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.

The second column of the table holds a boolean value of whether the instructions present within the current mandatory date, should be copied down to all dates between the current mandatory date and the next mandatory date.

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.

The second column thus indicates whether, for the time steps from the current mandatory date to the next mandatory date, the steps in-between will take the payoff from the current mandatory date.

From the third 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 top 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 : "TreeGPricer"



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




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

  4. ValueDate parameter

    Key to an already created Valuation Date Object. (Via the ValueDateObj() function).
  5. dayCounter parameter

    Used to calculate time in years.
  6. 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).
  7. MinNoOfSteps parameter

    The minimum number of steps that the discretization of the Mandatory Dates column (first column) within the PayOff table will take. (Will be at least the number of points within the 'MandatoryDates' parameter array).
  8. 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.
  9. Interp1D_1 parameter

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

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

    An optional 2D Interpolation Object. You can refer to this function within the PayOff table as Interp2D(1, XValue, YValue)
  12. 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 CTTreePricer.GenericTreePricer( _
String Key, _
Long Reload, _
String stochProcess, _
String ValueDate, _
DayCountEnum dayCounter, _
Variant PayOffTable, _
Long MinNoOfSteps, _
Variant ConstParams, _
String Interp1D_1, _
String Interp1D_2, _
String Interp2D_1, _
String Interp2D_2)


Excel Spreadsheet Syntax


=CT.PRO.GenericTreePricer(
Excel String Cell Key,
Excel Numeric Cell Reload,
Excel String Cell stochProcess,
Excel String Cell ValueDate,
Excel String Cell dayCounter,
XLRange PayOffTable,
Excel Numeric Cell MinNoOfSteps,
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 GenericTreePricer(
std::string Key,
long Reload,
std::string stochProcess,
std::string ValueDate,
DayCountEnum dayCounter,
CTRangeDataCPP PayOffTable,
long MinNoOfSteps,
CTRangeDataCPP ConstParams,
std::string Interp1D_1,
std::string Interp1D_2,
std::string Interp2D_1,
std::string Interp2D_2);


DotNET Syntax


System.String CTTreePricerSA.GenericTreePricer(
System.String Key,
System.Int32 Reload,
System.String stochProcess,
System.String ValueDate,
CTIEnums.DayCountEnum dayCounter,
CTRangeData PayOffTable,
System.Int32 MinNoOfSteps,
CTRangeData ConstParams,
System.String Interp1D_1,
System.String Interp1D_2,
System.String Interp2D_1,
System.String Interp2D_2);

Parameter data types

ArgNameArgTypeIsKey
KeyStringFALSE
ReloadLongFALSE
stochProcessStringTRUE
ValueDateStringTRUE
dayCounterDayCountEnumFALSE
PayOffTableRangeFALSE
MinNoOfStepsLongFALSE
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
KeyFALSEMyGenericTreePricer
ReloadFALSE1
stochProcessFALSEstochProcessNAME.EXTTAG.TICKER (from a function call)
ValueDateFALSEValueDateNAME.EXTTAG.TICKER (from a function call)
dayCounterFALSEACT365F
PayOffTableFALSEGenericTreePricer_PayOffTable_Range (creates a range object)
MinNoOfStepsFALSE50
ConstParamsTRUEGenericTreePricer_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.

19/Jul/2005FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2006FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jul/2006FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2007FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jul/2007FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2008FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jul/2008FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2009FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jul/2009FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2010FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jul/2010FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))
19/Jan/2011FalseAsset(cRow) + 10pctInterp1D(1,cRow)GridRowSum(cRow, cCol-2, cCol-1)max(Cell(cRow, cCol-1) - _var1, 0.0)max(Cell(cRow, cCol-1), PVCol(cCol))

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



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

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

GenericTreePricer_PayOffTable_builder.Append("{");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2005#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2006#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2006#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2007#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2007#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2008#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2008#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2009#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2009#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2010#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jul/2010#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol)) ;");
GenericTreePricer_PayOffTable_builder.Append("#19/Jan/2011#	 | False	 | Asset(cRow) + 10pct	 | Interp1D(1,cRow)	 | GridRowSum(cRow, cCol-2, cCol-1)	 | max(Cell(cRow, cCol-1) - _var1, 0.0)	 | max(Cell(cRow, cCol-1), PVCol(cCol))");
GenericTreePricer_PayOffTable_builder.Append("}");

// Parse the string into the Range object.
GenericTreePricer_PayOffTable.RangeFromStr( GenericTreePricer_PayOffTable_builder.ToString() );


Example range for parameter : ConstParams

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

_a5
_b20
_c2.5
_var180

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



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

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

GenericTreePricer_ConstParams_builder.Append("{");
GenericTreePricer_ConstParams_builder.Append("_a	 | 5 ;");
GenericTreePricer_ConstParams_builder.Append("_b	 | 20 ;");
GenericTreePricer_ConstParams_builder.Append("_c	 | 2.5 ;");
GenericTreePricer_ConstParams_builder.Append("_var1	 | 80");
GenericTreePricer_ConstParams_builder.Append("}");

// Parse the string into the Range object.
GenericTreePricer_ConstParams.RangeFromStr( GenericTreePricer_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 GenericTreePricer() 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 GenericTreePricer() function call


MyGenericTreePricer_1.TreeGPricer.0

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