The Black–Scholes price rests on a claim: a trader who sells an option can remove all of its risk by holding the right number of shares, adjusted continuously. In practice "continuously" means a few times a day at best, every trade costs money, and the volatility you priced with is not the volatility you get. This lesson simulates the hedge and measures what is left: a hedging error that shrinks with rebalancing but never vanishes, and a bet on volatility that hedging can't remove.
| Symbol | Meaning |
|---|---|
| Delta: the number of shares held per option | |
| The number of times the hedge is rebalanced before expiry | |
| implied vol | The volatility used to price the option (and compute its delta) |
| realised vol | The volatility the stock actually turns out to have |
| vega | The option price's sensitivity to volatility (see the Greeks) |
| hedging error | The P&L left over after hedging: zero for a perfect hedge |
The hedge
Sell one call for its Black–Scholes price. To offset the risk, buy shares, borrowing what the premium doesn't cover. As the stock moves, delta changes, so at each rebalance buy or sell shares to bring the holding back to the new delta. At expiry, sell the shares, pay the option's payoff, and see what is left.
If the stock really followed geometric Brownian motion with the volatility used for pricing, and you could rebalance continuously at no cost, what is left would be exactly zero. That is the replication argument behind Black–Scholes, and it is why the option's price doesn't depend on the stock's expected return.
Hedging error
With rebalances, between each one the position is only hedged against small moves. The gamma of the short option means that a large move in either direction costs money before the next rebalance, and a quiet period earns the theta. These don't cancel exactly on any one path, so the final P&L is random.
Choose the number of rebalances below. Each bar counts paths by their final P&L:
- Paths
- 0
- Average P&L
- –
- Spread (sd)
- –
- Theory √(π/4)·vega·σ/√N
- 0.87
With realised volatility equal to implied (20%), the P&L centres on zero, and its spread shrinks by about half each time the number of rebalances is multiplied by four. That is the familiar , and there is an approximate formula for it, due to Derman and Kamal:
For this 3-month at-the-money call (vega 19.64 per 1.00 of volatility), the simulation in the code below gives:
| Rebalances | Simulated spread | Formula |
|---|---|---|
| 4 | 1.600 | 1.741 |
| 16 | 0.845 | 0.870 |
| 64 | 0.418 | 0.435 |
| 256 | 0.216 | 0.218 |
The option's price is about 4.6, so even hedging 256 times leaves a typical error of about 5% of the premium. In real markets each rebalance also pays the spread, so hedging more often reduces risk but raises costs. Choosing how often to hedge is a real trade-off, and desks often rebalance when delta has drifted by more than a threshold rather than on a fixed schedule.
Key idea. Discrete hedging leaves an error that shrinks like . Reducing it costs transaction costs; a hedge is a choice about how much risk to keep.
Hedging doesn't remove the volatility bet
Now set realised volatility to 30% while the option is still priced, and hedged, at 20%. The whole distribution moves left: the seller loses on average, about 1.96 per option, however often they rebalance. That loss is almost exactly vega times the volatility gap, .
The reason is gamma. Every move costs the short-gamma hedger about , and theta pays them back an amount set by the implied volatility. When the stock moves more than implied, the costs win on every path, and hedging more often doesn't change that: it only makes the outcome more certain.
This is the most important practical point about options. A delta-hedged option is a position in volatility: the buyer wins if realised volatility beats implied, the seller wins if it doesn't. The implied volatility in the price is the market's estimate, and option trading is largely about whether that estimate is too high or too low.
Key idea. Delta hedging removes exposure to the stock's direction, not to its volatility. A hedged option seller profits when the stock moves less than the price implied, and loses when it moves more.
In code
from math import erf, exp, log, pi, sqrt
import numpy as np
def N(x):
return 0.5 * (1 + erf(x / sqrt(2)))
def bs_call(S, K, r, sigma, T):
if T <= 0:
return max(S - K, 0.0), (1.0 if S > K else 0.0)
d1 = (log(S / K) + (r + sigma**2 / 2) * T) / (sigma * sqrt(T))
d2 = d1 - sigma * sqrt(T)
return S * N(d1) - K * exp(-r * T) * N(d2), N(d1)
def hedged_pnl(rebalances, realised_vol, rng, S=100.0, K=100.0, r=0.05, implied_vol=0.20, T=0.25):
"""Sell one call at the implied-vol price and delta-hedge it until expiry."""
dt = T / rebalances
price, delta = bs_call(S, K, r, implied_vol, T)
cash = price - delta * S # premium received, minus the shares bought
for step in range(1, rebalances + 1):
S *= exp((r - realised_vol**2 / 2) * dt + realised_vol * sqrt(dt) * rng.standard_normal())
cash *= exp(r * dt)
_, new_delta = bs_call(S, K, r, implied_vol, T - step * dt)
if step < rebalances:
cash -= (new_delta - delta) * S # rebalance the hedge
delta = new_delta
return cash + delta * S - max(S - K, 0.0) # unwind the shares, pay the option's payoff
rng = np.random.default_rng(5)
for rebalances in (4, 16, 64, 256):
pnl = np.array([hedged_pnl(rebalances, 0.20, rng) for _ in range(4000)])
print(f"{rebalances:>3} rebalances: mean {pnl.mean():+.3f}, sd {pnl.std():.3f}")
pnl = np.array([hedged_pnl(64, 0.30, rng) for _ in range(4000)])
print(f"realised 30% vs implied 20%, 64 rebalances: mean {pnl.mean():+.3f}, sd {pnl.std():.3f}")
The means for the four rebalancing frequencies are , , and , all within noise of zero, with the spreads in the table above. The last line prints a mean of with spread 1.080 when realised volatility is 30%.
Where this shows up in quant work
- Options desks delta-hedge continuously and manage what is left: gamma, vega and the costs of hedging. Deciding when to rebalance is a daily, quantitative decision.
- Volatility trading. Buying options and delta-hedging them is the standard way to bet that realised volatility will exceed implied. The P&L in this lesson is exactly that trade's.
- Model risk. The hedge depends on the model's delta. If the model is wrong (for example, volatility changes with the stock price), the hedge leaks, and that leak is measured the same way.
Exercises
- Add a transaction cost of 1 cent per share traded to
hedged_pnl. At what number of rebalances does the average cost start to outweigh the reduction in spread? - Rebalance only when delta has moved by more than 0.05 since the last trade. How many trades does that take on average, and what spread does it achieve compared with fixed schedules?
- Set realised volatility to 15%. What happens to the hedged seller's average P&L, and how does it compare with vega × (realised − implied)?
Key takeaways
- Selling an option and holding delta shares, rebalanced, replicates the option only in the limit of continuous, costless trading.
- With rebalances the hedging error has spread about ; costs make infinite rebalancing impossible.
- Hedging removes direction, not volatility: the hedged P&L is about vega times (implied − realised) for the seller.
- Implied volatility is a price; option trading is largely a view on whether it is too high or low.

