template class xf::fintech::TreeLattice¶
#include "tree_lattice.hpp"
Overview¶
Generalized structure compatible with different models and instruments.
Parameters:
DT | date type supported include float and double. |
Model | short-rate model for Tree Engine |
Process | stochastic process |
Instrument | swaption, swap, cap floor, callable bond |
DIM | 1D or 2D short-rate model |
LEN | maximum length of timestep, which affects the latency and resources utilization. |
LEN2 | maximum length of node of tree, which affects the latency and resources utilization. |
template < typename DT, typename Model, typename Process, typename Instrument, int DIM, int LEN, int LEN2 > class TreeLattice
Methods¶
setup¶
setup overload (1)¶
void setup ( Model& model, DT* process, unsigned endCnt, DT r, DT x0, DT* time, DT* dtime )
setup setup parameter and initialize 1D framework of TreeLattice , and compute short-rate
Parameters:
model | short-rate model for Tree Engine |
process | parameters of stochastic process |
endCnt | end counter of timepoints |
r | floating benchmark annual interest rate |
x0 | initial underlying |
time | array timepoints |
dtime | array the difference between the next timepoint and the current timepoint |
setup overload (2)¶
void setup ( Model& model, DT* process1, DT* process2, unsigned endCnt, DT r, DT x0, DT* time, DT* dtime )
setup setup parameter and initialize 2D framework of TreeLattice , and compute short-rate
Parameters:
model | short-rate model for Tree Engine |
process1 | parameters of stochastic process |
process2 | parameters of stochastic process |
endCnt | end counter of timepoints |
r | floating benchmark annual interest rate |
x0 | initial underlying |
time | array timepoints |
dtime | array the difference between the next timepoint and the current timepoint |
rollback¶
void rollback ( Model& model, Instrument& engine, unsigned from, DT* time, DT* dtime, DT* NPV )
rollback calculate pricing result
Parameters:
model | short-rate model for Tree Engine |
engine | swaption, swap, cap floor, callable bond |
from | begin counter |
time | array timepoints |
dtime | array the difference between the next timepoint and the current timepoint |
NPV | is pricing result |