A C++ implementation of fast Monte Carlo pricing methods for down-and-out barrier options under the Merton Jump Diffusion model. This repository contains a modular pricing system, example executable, and a test suite used to validate the pricing algorithms.
code/— main C++ implementation, headers, source files, and build configurationcode/src/main.cpp— example program that constructs a barrier option and computes pricescode/tests/— Catch2-based tests for pricing methodsdocs/— dissertation document with mathematical derivation and research results
See
docs/Efficient_Barrier_Pricing_Daneel_Patel_final.pdffor the full dissertation and theoretical background.
The code implements pricing for barrier options using several numerical methods. It is designed for modularity and extensibility, separating:
- asset dynamics (
Dynamics) - underlying security (
Stock) - option payoffs and barriers (
Option,Barrier) - pricing algorithms (
IPricingimplementations)
Supported pricing engines include:
StandardMonteCarloUniformSampleTaylorApproximation
In the code/ directory:
cd code
mkdir -p build
cd build
cmake ..
cmake --build .Then run the example:
./mainRun the test suite:
ctest --output-on-failureThe example program demonstrates a workflow with:
MertonJumpDynamics(r, sigma, lambda, mu_jump, sigma_jump)Stock(S0, dynamics)DownAndOut(ExerciseType::European, OptionType::Call, strike, barrier, maturity)- a pricing engine such as
UniformSample,TaylorApproximation, orStandardMonteCarlo - calling
Price()orPriceWithVarianceReduction()
The main executable prints a price estimate and the standard error.
The project includes integration tests that verify down-and-out call pricing for different methods. The tests use a reference price and validate the algorithms with Catch2.
code/include/— header files for dynamics, options, stock, and pricing algorithmscode/src/— implementation of the library and the example programcode/tests/— test implementations and helper functions
To add new models or products:
- implement a new
IDynamicsmodel for a different stochastic process - extend the
Optionhierarchy for new derivative payoffs - reuse existing pricing engines or add a new
IPricingimplementation
- The project is built with C++23.
- The example program currently prices a down-and-out European call under a Merton jump diffusion model.
- The modular design allows easy swapping of models, products, and pricing engines.