#include "xf_fintech/mc_engine.hpp"
template < typename DT = double, int UN = 2, int UN_STEP = 2 > void MCAmericanEngineCalibrate ( DT timeLength, DT riskFreeRate, DT strike, bool optionType, ap_uint <8*sizeof (DT)*UN>* priceIn, ap_uint <8*sizeof (DT)>* matIn, ap_uint <8*sizeof (DT)*4>* coefOut, unsigned int calibSamples = 4096, unsigned int timeSteps = 100 )
American Option Pricing Engine using Monte Carlo Method. Calibrate kernel: this kernel reads the sample price data from external memory and use them to calculate the coefficient.
Parameters:
DT | supported data type including double and float data type, which decides the precision of result, default double-precision data type. |
UN | number of Monte Carlo Module in parallel (in path dimension), which affects the latency and resources utilization, default 2. [this unroll number should be equal to UN in MCAmericanEnginePresample] |
UN_STEP | number of Monte Carlo Module in parallel (in time steps dimension), which affects the latency and resources utilization, default 2. [this Unroll is completely resource bounded, unrelated to other params] |
timeLength | the time length of contract from start to end. |
riskFreeRate | risk-free interest rate. |
strike | the strike price also known as exericse price, which is settled in the contract. |
optionType | option type. 1: put option, 0: call option. |
priceIn | the price data, read in from DDR or HBM |
matIn | the matrix data, read in from DDR or HBM |
coefOut | the coef data that calculated by this kernel, the data can be stored to DDR or HBM |
calibSamples | sample numbers that used in calibration, default 4096. |
timeSteps | the number of discrete steps from 0 to T, T is the expiry time, default 100. |