template class xf::fintech::VModel

#include "v_model.hpp"

Overview

Vasicek model for Tree Engine.

Parameters:

DT data type supported include float and double
Tree class TrinomialTree
LEN2 maximum length of node of tree, which affects the latency and resources utilization.
template <
    typename DT,
    typename Tree,
    int LEN2
    >
class VModel

Methods

initialization

void initialization (
    DT r,
    DT spread,
    DT a,
    DT sigma,
    DT b
    )

initialize parameters

Parameters:

r floating benchmark annual interest rate
spread spreads on interest rates
a initial volatility of stock.
sigma the volatility of volatility.
b the short-rate follows an stochastic process with mean b.

discount

DT discount (
    DT t,
    DT dt,
    DT* x,
    DT r
    )

calculate the discount after time dt

Parameters:

t the current timepoint
dt the difference between the next timepoint and the current timepoint
x underlying
r shortrate

Returns:

discount

treeShortRate

void treeShortRate (
    Tree& tree,
    int endCnt,
    DT* time,
    DT* dtime,
    DT tmp_values1 [3][LEN2],
    DT tmp_values2 [3][LEN2],
    DT* statePrices,
    DT* rates
    )

calcutate short-rate of dt at t for TreeEngine

Parameters:

tree class TrinomialTree
endCnt end counter of timepoints
time array timepoints
dtime array the difference between the next timepoint and the current timepoint
tmp_values1 process values
tmp_values2 process values
statePrices state prices
rates array short-rates