Back to projects

Quantitative Finance · C++ · Pricing

C++ Option Pricing (CRR, Black-Scholes, Monte Carlo)

Academic group project in financial engineering using C++. The goal was to build an option-pricing base that combines several complementary approaches: the CRR binomial model, the closed-form Black-Scholes formula for European options, and Monte Carlo simulation. My main focus was the Monte Carlo block: improving numerical precision, handling large simulation volumes under time constraints, and making the calculations more reliable through payoff controls, bounds, and confidence intervals.

C++Monte CarloBlack-ScholesCRRMersenne TwisterVisual Studio

What this project demonstrates

Ability to implement quantitative pricers in C++ with an object-oriented design, and to optimize a Monte Carlo engine for both robustness and performance.

C++ Option Pricing (CRR, Black-Scholes, Monte Carlo) - detailed view

My role

Group project. My main contribution was the development and improvement of the Monte Carlo pricer, including path generation, numerical stability, 95% confidence intervals, high-path-count handling under runtime constraints, and integration of the Mersenne Twister random generator.

Context

The project sits in a market-finance context focused on option pricing. Team work was organized around a shared foundation for options and pricers, then deeper ownership of specific modules.

Objective

Compare several valuation methods in a single codebase, validate their consistency on standard cases, and deliver a usable Monte Carlo implementation for a high number of simulations.

Deep dive

Technical reading of the project

The project combines three pricing approaches, CRR, Black-Scholes, and Monte Carlo, inside an object-oriented C++ architecture. My main contribution focuses on the Monte Carlo engine and its robustness under load.

  • Support for several option families: vanilla, digital, Asian, and American.
  • Implementation of several pricers for comparison: CRR, closed-form Black-Scholes, and Monte Carlo simulation.
  • Path generation under Black-Scholes assumptions with dedicated time steps.
  • Price estimation, aggregated statistics, and 95% confidence intervals.
  • Safeguards for numerical edge cases to avoid incoherent outputs.

Gallery

Key screens and visualizations

Monte Carlo option-pricing logic implemented in C++

Overview of the Monte Carlo logic used to estimate option prices.

Architecture

Technical organization

Option hierarchy

Abstract Option class and specialized European, American, and Asian option types, each with polymorphic payoff logic.

Pricer layer

Separate pricers by method, such as CRRPricer, BlackScholesPricer, and BlackScholesMCPricer, to keep valuation assumptions clearly isolated.

Random engine

Singleton MT generator based on Mersenne Twister, used as a shared source for uniform and Gaussian draws.

Pricing test runner

Main executable used to compare pricer outputs under common parameters such as spot, strike, volatility, maturity, and rate.

Pipeline

Data flow

  1. 1.Set option parameters such as type, strike, and maturity, along with model inputs S0, r, and sigma.
  2. 2.Instantiate the appropriate pricer, whether CRR, closed-form Black-Scholes, or Monte Carlo.
  3. 3.For Monte Carlo, generate paths with Gaussian shocks drawn through Mersenne Twister.
  4. 4.Evaluate payoffs across paths and aggregate the outputs statistically.
  5. 5.Discount average payoffs to obtain the estimated price.
  6. 6.Compute confidence intervals to qualify the statistical uncertainty of the estimate.

Technical choices

Structuring decisions

Memory reuse in simulation

The Monte Carlo engine reuses path buffers to limit repeated allocations and remain efficient at high simulation counts.

Numerical robustness controls

Safeguards were added for non-finite and negative values, as well as variance stability, to avoid unstable outputs under heavy computation.

95% confidence interval

The pricer does not stop at a point estimate: it also returns a statistical range to judge simulation precision.

Clear separation by pricing method

The CRR, Black-Scholes, and Monte Carlo split makes comparisons easier and lets each engine evolve independently.

Reliability

Quality and controls

  • Validation of critical inputs such as null options, maturities, and path counts.
  • Explicit handling of Monte Carlo edge cases, including too few paths and unstable bounds.
  • Modular approach that makes unit testing easier at the option, pricer, and random-engine levels.

Limitations

Current attention points

  • The model remains based on Black-Scholes assumptions such as constant volatility and log-normal dynamics.
  • Speed and performance comparisons are not yet supported by a full automated benchmark suite.
  • The engine does not yet cover more advanced models such as stochastic volatility, jumps, or market calibration.

Roadmap

Next steps

  • Add a reproducible benchmark protocol covering CPU time and statistical error as a function of path count.
  • Extend the engine with variance-reduction techniques such as antithetic paths and control variates.
  • Connect pricing outputs to a broader portfolio-analysis module including sensitivities and scenarios.

Challenges

Main project challenges

Design a reusable option and pricer architecture for different payoff families such as vanilla, digital, Asian, and American options.

Run a large number of Monte Carlo simulations while keeping the code readable and latency acceptable.

Limit numerical drift such as non-finite values, negative variances caused by rounding, and confidence-interval edge cases.

Preserve financial consistency between the different pricing approaches: CRR, Black-Scholes, and Monte Carlo.

Outcomes and learnings

What I take away

C++ pricing framework covering European, American, and Asian options.

Monte Carlo pricer with statistical accumulation logic for mean, variance, and 95% confidence intervals.

Targeted performance improvements for Monte Carlo, including memory reuse and high-path execution under time constraints.

Mersenne Twister singleton integrated to standardize random-number generation across the project.

Other projects

Continue exploring

Wealth Tracking Application - project preview

Personal Finance · Python · PyQt6

Wealth Tracking Application

PyQt6 + SQLite desktop application to centralize multi-asset accounts, rebuild weekly history, and analyze portfolio performance.

View this project
Portfolio Backtesting and Optimization - project preview

Quantitative Finance · Analysis · Python

Portfolio Backtesting and Optimization

Python environment to backtest strategies, compare risk and return metrics, and analyze portfolio behavior.

View this project

Discuss

I can detail technical choices and outcomes during an interview.

If this project is relevant for you, I can detail the initial need, data structure, assumptions, challenges encountered, and analysis limitations.