template class xf::fintech::CPICapFloorEngine

#include "cpi_capfloor_engine.hpp"

Overview

CPICapFloorEngine CPI Cap/Floor Engine.

Parameters:

DT data type supported include float and double.
LEN maximum length of array
template <
    typename DT,
    int LEN
    >
class CPICapFloorEngine

Methods

init

void init (
    int xSize,
    int ySize,
    DT* timeIn,
    DT* rateIn,
    DT* priceIn
    )

init initialize arrays and parameters

Parameters:

xSize the actual size of array timeIn
ySize the actual size of array rateIn
timeIn array time, the difference between the maturity date and the reference date, unit is year.
rateIn array rate
priceIn array price

calcuNPV

DT calcuNPV (
    DT t,
    DT r
    )

calcuNPV calculate NPV function

Parameters:

t the difference between the maturity date and the reference date, unit is year.
r the strike rate

Returns:

return the NPV result