12. Black-Scholes: From Model to PnL#
This notebook covers the complete hedging workflow: pricing an option, computing Greeks, delta-hedging, and decomposing the resulting PnL into its components.
Black-Scholes isn’t really about the formula — it’s about the replicating portfolio. The price is just the cost of setting up the hedge.
12.1. Black-Scholes Pricing and Greeks#
The Black-Scholes price for a European call:
where \(\tau = T - t\) and:
The Greeks measure sensitivity to each input. For a call:
\(\Delta = \Phi(d_1)\)
\(\Gamma = \phi(d_1)/(S\sigma\sqrt{\tau})\)
\(\Theta = -S\phi(d_1)\sigma/(2\sqrt{\tau}) - rKe^{-r\tau}\Phi(d_2)\)
\(\mathcal{V} = S\phi(d_1)\sqrt{\tau}\)
ATM Call Option Greeks (S=K=100, T=0.25, sigma=20%)
==================================================
Price : 4.614997
Delta : 0.569460
Gamma : 0.039288
Theta : -10.474151
Vega : 19.644000
Rho : 13.082755
12.2. The Replicating Portfolio#
Black-Scholes is fundamentally a statement about replication: a European option can be perfectly replicated by continuously trading \(\Delta_t\) shares of stock and borrowing/lending at the risk-free rate.
The self-financing portfolio \(\Pi_t = \Delta_t S_t + B_t\) satisfies:
Hedging continuously with the BS delta, the portfolio tracks the option value exactly. We simulate this below to see how well it works in practice.
Final Results:
Option Payoff: 7.1043
Portfolio Value: 6.9489
Hedge PnL: -0.1554
12.3. Discrete Hedging and Gamma Bleeding#
In practice we can’t hedge continuously—this creates hedging error.
From the Taylor expansion of option value:
A delta-hedged portfolio has PnL:
Under continuous hedging, the gamma and theta terms exactly offset (the BS PDE). But with discrete hedging, \((dS)^2 \neq \sigma^2 S^2 dt\) on any given path—realized variance differs from implied. This mismatch creates what traders call “gamma bleeding.”
The standard deviation of discrete hedging PnL scales as \(O(1/\sqrt{n})\) where \(n\) is the number of rebalances.
Running hedge frequency analysis...
Hedge Frequency Analysis Results:
================================================================================
n_rebalances mean_pnl std_pnl min_pnl max_pnl 5th_percentile 95th_percentile
5 -0.027846 1.442597 -5.942480 3.528516 -2.453025 2.265067
10 0.033356 0.993593 -5.231665 3.047115 -1.609889 1.670701
25 -0.004569 0.702782 -3.482389 2.371135 -1.141420 1.142473
50 0.027501 0.491939 -3.283649 1.594189 -0.722729 0.824518
100 0.013918 0.333773 -1.177576 1.333243 -0.525763 0.586319
250 -0.005667 0.215202 -0.767826 1.051794 -0.362133 0.336460
Mean PnL roughly zero, std decreases with hedging frequency. If you think realised vol will exceed implied, you want to be long gamma. Otherwise short gamma.
12.4. PnL Attribution#
Every trading desk decomposes daily PnL into Greek components:
The unexplained residual is the key diagnostic. If it’s systematically nonzero, your model is missing something. If it’s random noise around zero, your model is capturing the main effects.
PnL Attribution Summary (summed over path):
==================================================
Delta : -4.630153
Gamma : 1.072117
Theta : -1.078983
Vega : 0.000000
Unexplained : 0.022022
Actual : -4.614997
Explained %: 100.48%
The gamma-theta scatter plot shows the fundamental tradeoff: long gamma means you profit from big moves, but you pay theta every day. Under Black-Scholes with realized vol matching implied, these two effects should cancel out on average.
When they don’t cancel:
Realized vol > implied vol → gamma PnL exceeds theta cost → long gamma wins
Realized vol < implied vol → theta cost exceeds gamma PnL → short gamma wins
This is the basis of volatility trading.
12.5. Detecting Model Failure#
The unexplained PnL should be mean-zero and randomly distributed. When it’s systematically positive or negative, your model is missing something important.
See what happens when we hedge with one volatility but the stock actually moves with a different realized volatility.
Running: Vol Match (20% vs 20%) scenario
Running: Low Realized (20% model, 15% real) scenario
Running: High Realized (20% model, 25% real) scenario
Summary Statistics:
======================================================================
Vol Match (20% vs 20%):
Mean Gamma PnL: 1.96438
Mean Theta PnL: -2.60777
Mean Net: -0.64339
Std Net: 0.51831
Low Realized (20% model, 15% real):
Mean Gamma PnL: 1.25175
Mean Theta PnL: -2.90478
Mean Net: -1.65303
Std Net: 0.48950
High Realized (20% model, 25% real):
Mean Gamma PnL: 2.81122
Mean Theta PnL: -2.45292
Mean Net: 0.35831
Std Net: 0.84885
When realised matches implied: gamma/theta PnL nets roughly zero. When they diverge, there’s a systematic edge — short gamma if realised < implied, long gamma if realised > implied. Delta-hedge to isolate the vol bet.
We haven’t modelled transaction costs or execution during vol spikes yet — in practice those eat into returns.
BS survives not because it’s correct but because the hedging framework is robust. Even with non-constant vol, delta-hedging with current implied vol gets you most of the way there. We test this under Heston next.