template class xf::fintech::HWModel¶
#include "hw_model.hpp"
Overview¶
Hull-White 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 HWModel
Methods¶
initialization¶
void initialization ( DT r, DT spread, DT a, DT sigma )
initialize parameters
Parameters:
r | floating benchmark annual interest rate |
spread | spreads on interest rates |
a | initial volatility of stock. |
sigma | the volatility of volatility. |
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 |