The theory of the pricing process is actually already introduced in the Theory Section. Similar to the European option engine, mcSimulation framework is employed. Compared to the European option engine, the difference is that it needs to calculate the optimal exercise at all time steps. The detailed implementation process of American engine is drawn as Figure Figure 63 shows.
- Generate uniform random numbers with Mersenne Twister UNiform MT19937 Random Number Generator (RNG) followed by Inverse Cumulative Normal (ICN) uniform random numbers. Thereafter, generate independent stock paths with the uniform random numbers and Black-Sholes path generator.
- Refer to Equation (3), calculate the exercise price at time step \(T\) by utilizing the calculated coefficients \(x\).
- Calculate the exercise price for previous time steps \(t\), and take the max exercise price by comparing the immediate exercise price with the held price value (maximum value for time steps \(t+1\)).
- Continue the process, until time step \(t\) equals 0, optimal exercise price and the standard deviation is obtained.
- Check if the standard deviation is smaller than the required tolerance defined by customers. If not, repeat step 1-4, until the final optimal exercise price is obtained.
Caution
Notice that the pricing module also supports another approach of ending pricing process, which utilizes the input parameter requiredSamples. When the requiredSamples are processed, we assume the output mean result is the final optimal exercise price. This mode is also supported in the American Option Pricing Engine. And the figure above only illustrates the ending approach with the required tolerance.
Note
In the figure, BRAM is used to load coefficients data that calculated from the calibration process. Here may use BRAM or DDR, it depends on the amount of data that need to be stored beforehand. The reason that coefficients data cannot be streamed is that the multi-Monte-Carlo process in pricing always needs to execute multiple times. Each time execution, these need to be loaded. Thus, it is impossible to use hls::stream.