A modular C++ option pricing engine implementing analytical and numerical methods for derivative pricing, including Black-Scholes, Monte Carlo simulation, variance reduction techniques, and performance benchmarking.
- Black-Scholes (closed-form)
- Monte Carlo Simulation
- European options
- Asian options (arithmetic average)
- Standard Monte Carlo
- Antithetic Variates (variance reduction)
- Confidence Intervals (95%)
- Standard Error estimation
- Delta
- Gamma
- Vega
- Theta
- Rho
- Call-Put Parity (Black-Scholes & Monte Carlo)
- Black-Scholes vs Monte Carlo comparison
- Monte Carlo convergence analysis
- Runtime comparison:
- Black-Scholes (ΞΌs)
- Monte Carlo Standard (ms)
- Monte Carlo Antithetic (ms)
- User inputs all parameters dynamically:
S0,K,r,y,sigma,T- pricing method (Black-Scholes / Monte Carlo)
- payoff style (European / Asian)
- option type (Call / Put)
- simulation count
- antithetic variates toggle
[ C = S_0 e^{-yT} N(d_1) - K e^{-rT} N(d_2) ]
[ d_1 = \frac{\ln(S_0/K) + (r - y + 0.5\sigma^2)T}{\sigma \sqrt{T}} ]
[ d_2 = d_1 - \sigma \sqrt{T} ]
[ S_T = S_0 \exp\left((r - y - 0.5\sigma^2)T + \sigma \sqrt{T} Z \right) ]
[ V = e^{-rT} \cdot \mathbb{E}[\text{Payoff}] ]
Use paired samples: [ Z \quad \text{and} \quad -Z ]
To reduce variance in Monte Carlo estimation.
g++ -std=c++17 main.cpp src/math_utils.cpp src/black_scholes.cpp src/monte_carlo.cpp src/analysis.cpp -o option_engine ./option_engine
β’ Built a modular C++ derivatives pricing engine
β’ Implemented stochastic simulation with GBM
β’ Applied Monte Carlo variance reduction
β’ Validated numerical methods against analytical pricing
β’ Performed convergence and runtime analysis
β’ Structured the codebase using reusable headers and source files
π§© Model Interpretation
- Asset follows Geometric Brownian Motion (GBM)
- Constant volatility
- Constant risk-free rate
- Continuous dividend yield
- No arbitrage opportunities
- Frictionless markets (no transaction cost, perfect liquidity)
- Continuous trading
- Lognormal return distribution
βΈ»
- Volatility is not constant (volatility smile/skew)
- Sudden jumps (earnings, macro shocks) violate GBM
- Interest rates and dividends change over time
- Transaction costs and liquidity constraints exist
- Discrete hedging introduces errors
- Not suitable for path-dependent options like arithmetic Asian
βΈ»
- Underlying follows GBM
- Random variables are normally distributed
- Large number of simulations ensures convergence
- Constant discount rate
βΈ»
- Model risk persists (depends on GBM assumption)
- Slow convergence for high accuracy
- High computational cost
- Tail risks may be underrepresented
- No closed-form benchmark for some exotic options
π Future Improvements
- Binomial Tree
- Trinomial Tree
- Barrier Options
- Lookback Options
- Digital Options
- Understanding derivatives pricing
- Comparing analytical vs numerical methods
- Studying Monte Carlo convergence
- Building reusable C++ quant infrastructure
π€ Author Wielly Halim Aspiring Quant Researcher | C++ & Python | Derivatives Pricing
If you found this project insightful, consider starring the repository.


