template class xf::fintech::FdG2SwaptionEngine

#include "fd_g2_swaption_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.
_exSize The number of exercise time supported in the bermudan swaption prcing engine.
_xGridMax The maximum number of locations for x direction in a layout.
_yGridMax The maximum number of locations for y direction in a layout.
_layoutSizeMax The maximum number of NPVs for each time step to calculate.
_dt The gobal variable of dt.
_shortRate The gobal variable of short rate to calculate.
_locationsX The location of x direction on a mesher.
_locationsY The location of y direction on a mesher.
_initialValues The vector of npv results by every rollback.
_g2Model The model engine based.
_dxMap The result of first and second derivative on x.
_dyMap The result of first and second derivative on y.
_corrMap The result of mixed derivative on x and y direction.
template <
    typename DT,
    Size _exSize,
    Size _xGridMax,
    Size _yGridMax,
    Size _layoutSizeMax = _xGridMax* _yGridMax
    >
class FdG2SwaptionEngine

// structs

struct NinePointLinear
struct TripleBandLinear

Methods

init

void init (
    DT a,
    DT sigma,
    DT b,
    DT eta,
    DT rho,
    Size tGrid,
    Size xGrid,
    Size yGrid,
    DT invEps,
    DT theta,
    DT mu,
    DT fixedRate,
    DT rate,
    DT nominal,
    DT stoppingTimes [_exSize+1],
    DT accrualTime [_exSize+1],
    DT floatingAccrualPeriod [_exSize+1],
    DT iborTime [_exSize+1],
    DT iborPeriod [_exSize+1]
    )

initilize the private members of class

Parameters:

a A factor of spreads on interest rates.
sigma Overall level of volatility on interest rates.
b A factor of spreads on interest rates.
eta A factor of interest rates.
rho A factor of interest rates.
tGrid The steps of npv to calculate.
xGrid The numbers of x direction to calculate.
yGrid The numbers of y direction to calculate.
layoutSize The numbers of mesher to calculate.
invEps The epsilon which is used to create the mesher, and the default value should be 1.0e-5.
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.
mu A factor for step.
nominal The nominal value of the swap.
fixedRate Fixed rate of the swaption. (per year)
rate Floating rate of the swaption. (per yaer)
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)
accrualTime The array which contains every payment time in fixed and floating rate. (the unit should be year)
floatingAccrualPeriod 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.

calculate

void calculate ()

the directly related interface for users

getNPV

DT getNPV ()

interface of get npv for users

Returns:

the result of npv