template class xf::fintech::DiscountingBondEngine

#include "discounting_bond_engine.hpp"

Overview

DiscountingBondEngine Discounting Bond Engine.

Parameters:

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

Methods

DiscountingBondEngine

DiscountingBondEngine ()

default constructor

init

void init (
    int size,
    DT* timeIn,
    DT* discIn
    )

init initialize array and parameter

Parameters:

size the actual size of array timeIn
timeIn array times, the difference between the maturity date and the reference date, unit is year.
discIn array logarithm of discount

calcuNPV

DT calcuNPV (
    DT t,
    DT amount
    )

calcuNPV calculate NPV function

Parameters:

t the difference between the maturity date and the reference date, unit is year.
amount redemption price (face value)

Returns:

return the NPV result