template class xf::fintech::BSModel

#include "bs_model.hpp"

Overview

Black-Scholes process.

Parameters:

DT data type supported include float and double.
template <typename DT>
class BSModel

// fields

DT riskFreeRate
DT dividendYield
DT volatility
DT var
DT stdDev
DT drift

Fields

DT riskFreeRate

risk-free interest rate.

DT dividendYield

the constant dividend rate for continuous dividends.

DT volatility

volatility of stock price.

DT var

variance of change in stock price after time interval dt.

DT stdDev

standard deviation of change in stock price after time interval dt according to the given discretization.

DT drift

drift of stock price after time interval dt.

Methods

variance

void variance (DT dt)

variance calculate the variance

Parameters:

dt time interval according to the given discretization

stdDeviation

void stdDeviation ()

stdDeviation calculate standard variance

updateDrift

void updateDrift (DT dt)

updateDrift calculate the drfit of expectation

Parameters:

dt time interval according to the given discretization.

evolve

DT evolve (
    DT x0,
    DT dt,
    DT dw
    )

calcuate the price value after time dt.

Parameters:

x0 initial value
dt time interval
dw random number

logEvolve

DT logEvolve (DT dw)

calcualte the change of logS after time dt.

Parameters:

dw randon number