MCBarrierEngine - 2023.2 English

Vitis Libraries

Release Date
2023-12-20
Version
2023.2 English
#include "xf_fintech/mc_engine.hpp"
template <
    typename DT = double,
    int UN = 10
    >
void MCBarrierEngine (
    DT underlying,
    DT volatility,
    DT dividendYield,
    DT riskFreeRate,
    DT timeLength,
    DT barrier,
    DT strike,
    ap_uint <2> barrierType,
    bool optionType,
    ap_uint <32>* seed,
    DT* output,
    DT rebate = 0,
    DT requiredTolerance = 0.02,
    unsigned int requiredSamples = 1024,
    unsigned int timeSteps = 100,
    unsigned int maxSamples = 134217727
    )

Barrier Option Pricing Engine using Monte Carlo Simulation.

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, which affects the latency and resources utilization, default 10.
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.
barrier single barrier value.
strike the strike price also known as exericse price, which is settled in the contract.
barrierType barrier type including: DownIn(0), DownOut(1), UpIn(2), UpOut(3).
optionType option type. 1: put option, 0: call option.
seed array to store the inital seeds for each RNG.
output output array.
rebate rebate value which is paid when the option is not triggered, default 0.
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, default 100.
maxSamples the maximum sample number. When reaching it, the simulation will stop, default 2,147,483,648.