template class xf::fintech::CIRModel¶
#include "cir_model.hpp"
Overview¶
Cox-Ingersoll-Ross 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 CIRModel
Methods¶
initialization¶
void initialization ( DT r, DT spread )
initialize parameter
Parameters:
| r | floating benchmark annual interest rate |
| spread | spreads on interest rates |
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 |