↓ Skip to main content

Recent

Calculating Implied Volatility with Newton-Raphson in NumPy - Verified Against Market Prices

Calculating Implied Volatility with Newton-Raphson in NumPy - Verified Against Market Prices

When we have a market price for an option, we often want to know what implied volatility produced that price. This is the implied volatility (IV) — the volatility parameter that, when fed into the Black-Scholes formula, reproduces the observed market price. In this post, we implement a robust implied volatility solver in NumPy using Newton-Raphson optimization with a bisection fallback, and verify it against test cases where the true volatility is known.
Implied Volatility Surface Construction from Local Volatility — Dupire Formula Verification

Implied Volatility Surface Construction from Local Volatility — Dupire Formula Verification

The volatility surface is the cornerstone of modern option pricing. Market participants quote prices in terms of implied volatility rather than price, and pricing models must reproduce this surface to be viable. In this post, we build an implied volatility surface from a local volatility model: simulate paths under the local volatility dynamics, compute call prices, and invert Black-Scholes numerically. Along the way we state Dupire’s formula correctly — it maps option prices to local volatility, not the other way around — together with Gatheral’s formula, which is the known analytical bridge from the implied surface to the local one. Every number shown comes from a reproducible NumPy script with numpy.random.default_rng(42).
Value at Risk Backtesting in Python: Comparing Historical, Parametric, and Monte Carlo Methods

Value at Risk Backtesting in Python: Comparing Historical, Parametric, and Monte Carlo Methods

Value at Risk (VaR) is the most widely used measure of market risk in finance. It answers a simple question: What is the worst loss I can expect over a given horizon with a certain confidence level? For example, a 1-day 99% VaR of $1M means that, on average, only 1 out of 100 days should see a loss exceeding $1M. But VaR is only useful if it actually captures real losses at the claimed frequency. This is where backtesting comes in: we check whether the number of exceedances (days when losses exceeded the VaR forecast) matches the confidence level. In this post, we implement three VaR estimation methods from scratch in NumPy: Historical VaR — ranking past returns and picking the quantile Parametric (Delta-Normal) VaR — assuming returns are normally distributed Monte Carlo VaR — simulating future paths from a calibrated model We then backtest each method against a known portfolio and verify that the coverage rates match the claimed confidence levels.