#include "xf_fintech/mc_engine.hpp"
template < typename DT = double, int UN = 2 > void MCAmericanEnginePricing ( DT underlying, DT volatility, DT dividendYield, DT riskFreeRate, DT timeLength, DT strike, bool optionType, ap_uint <32>* seed, ap_uint <8*sizeof (DT)*4>* coefIn, DT* output, DT requiredTolerance = 0.02, unsigned int requiredSamples = 4096, unsigned int timeSteps = 100, unsigned int maxSamples = 134217727 )
American Option Pricing Engine using Monte Carlo Method. Pricing kernel.
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] |
underlying | intial value of underlying asset at time 0. |
volatility | fixed volatility of underlying asset. |
dividendYield | the constant dividend rate for continuous dividends. |
riskFreeRate | risk-free interest rate. |
timeLength | the time length of contract from start to end. |
strike | the strike price also known as exericse price, which is settled in the contract. |
optionType | option type. 1: put option, 0: call option. |
seed | array of seed to initialize RNG. |
coefIn | the coef data that calculated by this kernel, the data is loaded from DDR or HBM |
output | the output price data (size=1), can be stroed in DDR or HBM |
requiredTolerance | the tolerance required. If requiredSamples is not set, when reaching the required tolerance, simulation will stop, default 0.02. |
requiredSamples | the samples number required. When reaching the required number, simulation will stop, default 1024. |
timeSteps | the number of discrete steps from 0 to T, T is the expiry time. |
maxSamples | the maximum sample number. When reaching it, the simulation will stop, default 2,147,483,648. |