Monte Carlo option pricing, step by step in Python
Monte Carlo option pricing estimates an option’s value by simulating many possible future prices of the stock, working out the option’s payoff in each one, and averaging those payoffs discounted to today. With enough simulations the average converges to the true price.
It is the most flexible pricing method in quantitative finance. A closed-form formula like Black-Scholes exists only for simple options; simulation handles options whose payoff depends on the whole path, on several assets, or on rules too messy for a formula.
How it works, in four steps
- Model the stock. Under the risk-neutral measure the stock follows geometric Brownian motion with drift equal to the risk-free rate r.
- Simulate. Draw N standard normal numbers Z and turn each into a price at expiry: ST = S0·exp((r − σ²/2)T + σ√T·Z).
- Pay out. For a call, each path pays max(ST − K, 0).
- Average and discount. The price is e−rT times the average payoff.
Monte Carlo pricing in Python
This prices a one-year at-the-money call (stock 100, strike 100, 5% rate, 20% volatility) with more and more paths, and reports a 95% confidence interval for each estimate:
import numpy as np
S0, K, T, r, sigma = 100, 100, 1.0, 0.05, 0.20
rng = np.random.default_rng(seed=42)
for n_paths in (1_000, 10_000, 100_000, 1_000_000):
Z = rng.standard_normal(n_paths)
ST = S0 * np.exp((r - 0.5 * sigma**2) * T + sigma * np.sqrt(T) * Z)
payoff = np.exp(-r * T) * np.maximum(ST - K, 0.0)
price = payoff.mean()
stderr = payoff.std(ddof=1) / np.sqrt(n_paths)
print(f"{n_paths:>9,} paths: {price:.4f} ± {1.96 * stderr:.4f} (95%)")
print("Black-Scholes: 10.4506")1,000 paths: 9.9120 ± 0.8788 (95%) 10,000 paths: 10.3887 ± 0.2904 (95%) 100,000 paths: 10.4260 ± 0.0918 (95%) 1,000,000 paths: 10.4578 ± 0.0289 (95%) Black-Scholes: 10.4506
Every interval contains the Black-Scholes value of 10.4506, and each tenfold increase in paths shrinks the interval by about √10 ≈ 3.2 times. That is the rule for Monte Carlo: the error falls like 1/√N, so one more correct decimal place costs a hundred times more paths.
Try it in your browser
Run the same simulation here. Pick a number of paths and run it a few times to see how much the answer moves:
When Monte Carlo is the right tool
- Path-dependent options. Asian options pay on the average price, barrier options switch on or off if a level is touched. Simulate the whole path in small steps and the payoff is easy.
- Many underlying assets. A basket option on ten stocks is a ten-dimensional integral. Trees and grids blow up with dimensions; Monte Carlo’s error does not.
- Risk measurement. Banks simulate whole portfolios to estimate Value at Risk.
For a single European option it is the slowest choice, which is exactly why it is taught on one: you can check the answer against the formula. For American options, plain Monte Carlo struggles with the early-exercise decision; the binomial model or the Longstaff-Schwartz regression method is used instead.
Making it converge faster
Variance reduction gets the same accuracy from fewer paths:
- Antithetic variates: use each draw Z twice, as Z and −Z, so the errors partly cancel.
- Control variates: simulate something with a known price alongside (the stock itself, or a vanilla option) and correct by its error.
- Quasi-random numbers: Sobol sequences fill the space more evenly than random draws, and often converge closer to 1/N.
Learn this on your phone, one short lesson at a time
QF-Learn turns topics like this into five-minute lessons with quizzes, finance games and certificates. It is free, and it is coming to Android and iOS. Leave your email and you will be first to get it.