QF-Learn

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

  1. Model the stock. Under the risk-neutral measure the stock follows geometric Brownian motion with drift equal to the risk-free rate r.
  2. Simulate. Draw N standard normal numbers Z and turn each into a price at expiry: ST = S0·exp((r − σ²/2)T + σ√T·Z).
  3. Pay out. For a call, each path pays max(ST − K, 0).
  4. Average and discount. The price is e−rT times the average payoff.
C ≈ e−rT · (1/N) · Σ max(ST(i) − K, 0)

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:

Python
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")
Output
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:

Monte Carlo price10.4724
95% interval± 0.2871
Black-Scholes10.4506

One-year call, stock 100, strike 100, 5% rate, 20% volatility. Each run draws fresh random numbers in your browser.

When Monte Carlo is the right tool

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:

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.