template class xf::fintech::FdHullWhiteEngine¶
#include "fd_hullwhite_engine.hpp"
Overview¶
Bermudan swaption pricing engine using Finite-difference methods.
Parameters:
DT | Data type supported including float and double, which decides the precision of the price, and the default data type is double. |
_ETSizeMax | The maximum number of exercise time supported in the bermudan swaption prcing engine. |
_xGridMax | The maximum number of NPVs for each time step to calculate. |
_legPSizeMax | The maximum number of times that payer should pay for the swaption in fixed rate. (depends on payment period) |
_legRSizeMax | The maximum number of times that payer should receive from the swaption in floating rate. (depends on payment period) |
template < typename DT, unsigned int _ETSizeMax, unsigned int _xGridMax, unsigned int _legPSizeMax, unsigned int _legRSizeMax > class FdHullWhiteEngine // fields DT array_[_xGridMax]
Methods¶
engineInitialization¶
void engineInitialization ( DT stoppingTimes [_ETSizeMax+1], DT payerAccrualTime [_legPSizeMax+1], DT receiverAccrualTime [_legRSizeMax+1], DT receiverAccrualPeriod [_legRSizeMax+1], DT iborTime [_legRSizeMax+1], DT iborPeriod [_legRSizeMax+1], unsigned int ETSize, unsigned int xGrid, unsigned int legPSize, unsigned int legRSize, DT a, DT sigma, DT theta, DT nominal, DT fixedRate, DT floatingRate )
This function is used to build up the FDM equation, and calculate the initialValues(NPVs at maturity), meanwhile, read several initial values from DDR to RAMs or registers.
@param stoppingTimes The array which contains every exercise time in sequence with a 0.99 day time point at the front. (the unit should be year) @param payerAccrualTime The array which contains every payment time in fixed rate. (the unit should be year) @param receiverAccrualTime The array which contains every payment time in floating rate. (the unit should be
year)
Parameters:
receiverAccrualPeriod | We support multiple day count convention, so this port is given to users to let them decide what kind of day count convention should be applied when calculating the amount of money in a period. |
iborTime | This array is used to calculate the discount at a specific time point. |
iborPeriod | This port is also given to users to let them decide what kind of day count convention should be applied when calculating the actual floating rate in a period. |
ETSize | The actual number of exercise time in the bermudan swaption. |
xGrid | The actual number of NPVs for each time step to calculate. |
legPSize | The actual number of times that payer should pay for the swaption in fixed rate. (depends on payment period) |
legRSize | The actual number of times that payer should receive from the swaption in floating rate. (depends on payment period) |
a | Spreads on interest rates. |
sigma | Overall level of volatility on interest rates. |
theta | Parameter used to build up the differential equation, the pricing engine uses crank-nicolson algorithm, so default value of theta should be 0.5 |
nominal | The nominal value of the swap. |
fixedRate | Fixed rate of the swaption. (per year) |
floatingRate | Floating rate of the swaption. (per yaer) |
rollbackImplementation¶
DT rollbackImplementation ( DT array [_xGridMax], DT from, DT to, unsigned int tGrid )
This function perform the main rolling back process in bermudan swaption pricing.
Parameters:
array | NPVs at a specific time point. |
from | Start time point of evolve back process. |
to | End time point of evolve back process. |
tGrid | Number of time steps from maturity to settlement date. |