A Complete C++ Valuation Engine: Monte Carlo, Black-Scholes, and DCF Models

I combined Monte Carlo simulation, the Black-Scholes model, and an Equity Valuation engine into a single C++ program, solidifying my understanding of pricing algorithms.

Today, I continued my journey into quantitative finance by building a comprehensive valuation engine. I believe that constructing the pricing algorithms myself is the most effective way to learn, allowing me to directly implement these tools in my investment and trading strategies. I integrated my Black-Scholes-Merton model equation from two days ago, my equity valuation engine from yesterday, and today I built a Monte Carlo option pricing simulation. Over the next few days, I plan to modularize and significantly improve the model. I will provide daily updates on my progress. You can follow my progress here: https://github.com/JohannesMeyerYC/RoadToQuant

Here are simple explanations of each model, followed by the complete, annotated code.

This model estimates an option's price by simulating thousands of potential future paths for the underlying asset's price. Each simulation generates a random price at the option's expiration based on the asset's expected return and volatility. The model calculates the option's payoff for each path, which is the amount of money the option would be worth at expiration. The average of all these payoffs is then discounted back to its present value using a risk-free interest rate. This final value represents the theoretical price of the option.

The formula for a single simulated stock price path at time $T$ is: $ S_T = S_0 e^{((r - \frac{1}{2}\sigma^2)T + \sigma\sqrt{T}Z)} $

Where: $S_T$ = Stock price at expiration, $S_0$ = Initial stock price, $r$ = Risk-free interest rate, $\sigma$ = Volatility, $T$ = Time to expiration, and $Z$ = A random number from the standard normal distribution.