A Python-based derivatives analytics library that implements the Black-Scholes-Merton model for European options pricing. It features a custom Newton-Raphson solver for calculating Implied Volatility and includes a visualization engine for Option Greeks (Delta, Gamma, Vega).
options-analytics/
|-- black_scholes.py # Core Pricing Engine (Price + Greeks).
|-- implied_volatility.py # Numerical Solver (Newton-Raphson) for IV.
|-- plot_greeks.py # Visualization script for sensitivity analysis.
|-- requirements.txt # Dependencies.
|-- README.md # Documentation.
- Pricing Engine: Calculates fair value for Call and Put options.
- Risk Metrics (The Greeks):
-
Delta (
$\Delta$ ): Sensitivity to underlying price. -
Gamma (
$\Gamma$ ): Sensitivity to Delta (Convexity). -
Vega (
$\nu$ ): Sensitivity to Volatility.
-
Implied Volatility Solver: Reverse-engineers market fear (
$\sigma$ ) from option prices using numerical optimization.
The engine implements the closed-form Black-Scholes solution:
Implied Volatility (Newton-Raphson)
Since
The engine plots the Greeks to visualize risk exposure across different strike prices.
- Red Line: Current Strike Price ($100).
- Green Curve (Gamma): Shows that risk/acceleration is highest At-The-Money.
- Install Dependencies
pip install -r requirements.txt - Run the Visualization
python plot_greeks.py - Calculate Implied Volatility
Check
implied_volatility.pyto see the solver in action:# Example Usage iv = implied_volatility(S=100, K=100, T=1, r=0.05, price_market=10.45) print(f"Implied Volatility: {iv}")
