template class xf::fintech::internal::TreeInstrument

#include "tree_instrument.hpp"

Overview

TreeInstrument swaption, swap, cap floor, callable bond.

Parameters:

DT date type supported include float and double.
IT 0: swaption, 1: swap, 2: cap floor, 3: callable bond
LEN2 maximum length of node of tree, which affects the latency and resources utilization.
template <
    typename DT,
    int IT,
    int LEN2
    >
class TreeInstrument

Methods

reset

void reset (
    unsigned size,
    DT values [][LEN2]
    )

reset reset values

Parameters:

size size of used values
values process values to calulate NPV

stepback

stepback overload (1)

void stepback (
    unsigned j,
    unsigned index,
    DT discount,
    DT* probs,
    DT values1 [][LEN2],
    DT values2 [][LEN2]
    )

stepback calculate values of the current timepoint based on the values of the next timepoint for 1D framework.

Parameters:

j node of tree structure
index node of tree structure
discount price of the current timepoint relative to the next timepoint.
probs probability of node of tree structure
values1 process values to calulate NPV
values2 process values to calulate NPV

stepback overload (2)

void stepback (
    unsigned j,
    unsigned* index,
    unsigned modulo,
    DT discount,
    DT probs [2][3],
    DT values1 [][LEN2],
    DT values2 [][LEN2]
    )

stepback calculate values of the current timepoint based on the values of the next timepoint for 2D framework.

Parameters:

j node of tree structure
index node of tree structure
modulo node length of the next timepoint
discount price of the current timepoint relative to the next timepoint.
probs probability of node of tree structure
values1 process values to calulate NPV
values2 process values to calulate NPV

adjustValues

void adjustValues (
    int i,
    int size,
    DT t,
    DT values1 [][LEN2],
    DT values2 [][LEN2]
    )

adjustValues Adjust value based on conditions

Parameters:

i the current timepoint counter
size node size of tree structure of the current timepoint
t the current timepoint
values1 process values to calulate NPV
values2 process values to calulate NPV