Monte Carlo option pricing engine in C++ with a Python wrapper for visualization.
quantitative-finance-engine/
├── src/monte_carlo.cpp # C++ engine + CLI entry point
├── include/monte_carlo.h # Public API header
├── python/
│ ├── wrapper.py # Python interface (falls back to pure-Python if no binary)
│ └── visualize.py # Matplotlib plots
└── CMakeLists.txt
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
./monte_carlo # prints call/put prices to terminalpip install numpy matplotlibpython python/visualize.pyNo C++ toolchain?
visualize.pyworks with the pure-Python fallback automatically.
| Component | Description |
|---|---|
| Black-Scholes | Closed-form analytical price (used as ground truth) |
| Monte Carlo | Geometric Brownian Motion simulation over N paths |
| Convergence plot | Shows MC estimate stabilizing toward B-S price |
| Distribution plot | Histogram of terminal payoffs |
| Symbol | Value | Meaning |
|---|---|---|
| S | 100 | Current stock price |
| K | 100 | Strike price (ATM) |
| T | 1.0 | 1 year to expiry |
| r | 5 % | Risk-free rate |
| σ | 20 % | Volatility |
| N | 100 000 | Simulations |
