template class xf::fintech::G2Model¶
#include "g2_model.hpp"
Overview¶
Two-additive-factor gaussian 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 G2Model
Methods¶
initialization¶
void initialization ( DT r, DT a, DT sigma, DT b, DT eta, DT rho )
initialize parameters
Parameters:
r | floating benchmark annual interest rate |
a | initial volatility of stock. |
sigma | the volatility of volatility. |
b | initial volatility of stock. |
eta | the volatility of volatility. |
rho | the correlation coefficient between price and variance. |
discount¶
DT discount ( DT t, DT dt, DT* x, DT r = 0.0 )
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 | invalid input |
Returns:
discount
treeShortRate¶
void treeShortRate ( Tree* tree, int endCnt, DT* time, DT* dtime, internal::xf_2D_array <DT, 4, LEN2>& tmp_values1, internal::xf_2D_array <DT, 4, LEN2>& tmp_values2, 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 |
rates | array short-rates |