A quantitative finance project implementing a full option pricing engine in Python, featuring Black-Scholes analytical pricing, Monte Carlo simulation with antithetic variance reduction, and an implied volatility surface, all wrapped in an interactive Streamlit dashboard.
Run locally with:
streamlit run app.pyThis engine prices European options using two independent methods and compares their results:
- Black-Scholes — closed-form analytical solution with all five Greeks
- Monte Carlo — Geometric Brownian Motion simulation with antithetic variance reduction
- Implied Volatility — Newton-Raphson solver with Brent's method fallback, used to construct a full volatility surface
- Pricing & Greeks tab — real-time BS price and Greeks (delta, gamma, vega, theta, rho) with interactive Greeks vs spot price chart
- Monte Carlo tab — side-by-side BS vs MC vs antithetic pricing with 95% confidence intervals and convergence analysis chart
- Vol Surface tab — interactive 3D implied volatility surface showing volatility smile and term structure, with color-coded table view
- Price Surface tab — 3D option price surface and heatmap across spot prices and expiries
The stock price follows Geometric Brownian Motion:
The closed-form solution for a European call:
Where:
S— current stock priceK— strike priceT— time to expiration (years)r— risk-free interest rateσ— volatilityN(·)— cumulative standard normal distribution
Simulates terminal stock prices using the GBM closed-form solution:
Option price estimated as the discounted average payoff across all simulations:
Variance reduction via antithetic variates: each
| Greek | Formula | Interpretation |
|---|---|---|
| Delta (Δ) | ∂V/∂S = N(d₁) | Price change per $1 move in stock. Hedge ratio. |
| Gamma (Γ) | ∂²V/∂S² = φ(d₁)/(Sσ√T) | Rate of change of delta. Same for calls and puts. |
| Vega (ν) | ∂V/∂σ = Sφ(d₁)√T/100 | Price change per 1 vol point move. |
| Theta (Θ) | ∂V/∂t | Daily time decay. Almost always negative for long options. |
| Rho (ρ) | ∂V/∂r | Price change per 1% rate move. |
# Clone the repository
git clone https://github.com/Alec-Teff/option-pricing-engine.git
cd option-pricing-engine
# Create and activate virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1 # Windows
source .venv/bin/activate # Mac/Linux
# Install dependencies
pip install -r requirements.txt
# Run the dashboard
streamlit run app.py22 unit tests covering put-call parity, Greeks behavior, Monte Carlo convergence, and implied volatility recovery:
pytest tests/ -vValidated against live AAPL market data:
| Method | Price | Std Error |
|---|---|---|
| Black-Scholes | $3.80 | exact |
| Monte Carlo (100k paths) | $3.81 | 0.0919 |
| Antithetic (100k paths) | $3.76 | 0.0911 |
Monte Carlo convergence: price estimate stabilizes to within $0.01 of Black-Scholes at 100,000 simulations.
- Python 3.14
- NumPy — vectorized simulation and math
- SciPy — normal distribution functions, Brent's method root-finder
- Streamlit — interactive web dashboard
- Plotly — 3D surface plots and heatmaps
- yfinance — live market data
- Black-Scholes PDE derivation and no-arbitrage pricing
- Risk-neutral measure and why option prices don't depend on expected returns
- Geometric Brownian Motion and Ito's Lemma
- Monte Carlo variance reduction techniques
- Numerical root-finding (Newton-Raphson, Brent's method)
- Volatility smile and term structure
- Greeks and delta hedging
Alec Teff — Georgia Tech, Class of 2029, BS Mathematics, BS Chemical Engineering. Built as a quantitative finance portfolio project during Summer 2026