A from-scratch implementation of the Black-Scholes options pricing model — the Nobel Prize-winning formula (1997) used by every options trading desk in the world. Rather than just calling a library, you build the math yourself, which is exactly what quant interviews test.
Unlike the Momentum Backtester (which simulates a strategy over time), this project is about mathematical modeling at a single point in time: given five inputs, what is a fair price for an option?
An option is a contract that gives the holder the right (but not the obligation) to buy or sell a stock at a specific price (the strike) before a certain date (expiry). The buyer pays a premium for this right. The central question: what should that premium be?
options_calculator/
├── models/
│ ├── black_scholes.py # Core BS formula: call/put price + all Greeks
│ └── binomial.py # Alternative Cox-Ross-Rubinstein tree model
├── analysis/
│ ├── implied_vol.py # Reverse Black-Scholes: find sigma from market price
│ └── visualizer.py # Payoff diagrams, Greek surface plots, vol smile
├── main.py # Entry point — configure and run here
└── requirements.txt # numpy, scipy, matplotlib
| Symbol | Name | What it means | Example |
|---|---|---|---|
| S | Stock price | What the stock costs right now | $100 |
| K | Strike price | The price you'd buy/sell at | $105 |
| T | Time to expiry | How long until the option expires (in years) | 0.5 = 6 months |
| r | Risk-free rate | Return on a "safe" investment like Treasury bonds | 0.04 = 4% |
| σ | Volatility | How wildly the stock moves (annualised) | 0.20 = 20% |
These five numbers go in. One fair price comes out.
Both are priced by the same Black-Scholes formula with a small variation.
Beyond just the price, the project computes all five Greeks — measures of how sensitive the option price is to each input changing:
| Greek | Symbol | What it measures | Plain English |
|---|---|---|---|
| Delta | Δ | Sensitivity to stock price | Option gains $0.50 per $1 stock move (if Δ = 0.5) |
| Gamma | Γ | Rate of change of Delta | How fast your exposure shifts as stock moves |
| Theta | Θ | Sensitivity to time | How much value you lose each day just from time passing |
| Vega | V | Sensitivity to volatility | How much price changes per 1% move in volatility |
| Rho | ρ | Sensitivity to interest rate | How much price changes per 1% move in rates |