Monte Carlo option pricer
Simulate thousands of price paths, price a European option, and watch the estimate converge to Black-Scholes.
How it works
Under the risk-neutral measure an option's price is the discounted average payoff. Monte Carlo estimates that average by simulating terminal prices from geometric Brownian motion and averaging the payoffs. The standard error falls with the square root of the number of paths, so four times as many paths halves the error.
Antithetic variates pair every random draw with . The two payoffs are negatively correlated, so their average has lower variance, often for free. Black-Scholes gives the exact answer here, which makes this a clean way to see Monte Carlo error.
Assumptions
- European payoff, so only the terminal price is simulated; the path chart is for illustration.
- Constant rate, volatility and dividend yield.
- With antithetic variates each pair counts as one sample when computing the standard error.
- Fixed seed: the same inputs always give the same estimate.
Show the codePython, runs in the playground
import numpy as np
from scipy.stats import norm
S, K, r, sigma, T, N = 100, 100, 0.05, 0.20, 1.0, 100_000
Z = np.random.default_rng(1).standard_normal(N // 2)
ST = lambda z: S * np.exp((r - 0.5 * sigma**2) * T + sigma * np.sqrt(T) * z)
pay = lambda z: np.exp(-r * T) * np.maximum(ST(z) - K, 0)
plain = pay(np.concatenate([Z, np.random.default_rng(2).standard_normal(N // 2)]))
anti = 0.5 * (pay(Z) + pay(-Z)) # antithetic pairs
print(f"Plain MC: {plain.mean():.4f} +/- {1.96 * plain.std(ddof=1) / np.sqrt(len(plain)):.4f}")
print(f"Antithetic MC: {anti.mean():.4f} +/- {1.96 * anti.std(ddof=1) / np.sqrt(len(anti)):.4f}")
d1 = (np.log(S / K) + (r + 0.5 * sigma**2) * T) / (sigma * np.sqrt(T))
print(f"Black-Scholes: {S * norm.cdf(d1) - K * np.exp(-r * T) * norm.cdf(d1 - sigma * np.sqrt(T)):.6f}")
Questions
Why use Monte Carlo when Black-Scholes exists?
For a European option you would not. Monte Carlo matters for payoffs with no formula, such as Asian, barrier and basket options, or for models beyond Black-Scholes. Pricing a European option first tells you how accurate your simulation is.
How many paths do I need?
The error shrinks as 1 over the square root of the number of paths. For a 10-dollar option, 100,000 paths gives a 95% band of a few cents; halving that needs four times as many paths.
What do antithetic variates do?
They pair each random draw with its mirror image. Because the two payoffs move in opposite directions, their average is less noisy, so you get a tighter band for the same work.
Is the 95% band guaranteed to contain the true price?
No. About 1 run in 20 will miss. That is what a 95% interval means.
Educational use only, not investment advice. Results depend on the model's assumptions listed above and on your inputs. Calculations run in your browser and nothing you enter is sent to a server.