Lesson 13 of 15

Monte Carlo Pricing

Monte Carlo Pricing

Monte Carlo simulation is the most flexible method for pricing options. Instead of solving equations analytically, we simulate thousands of possible stock price paths and average the payoffs.

The Stock Price Model

Under risk-neutral measure, the stock price follows:

ST=Sexp((rσ22)T+σTZ)S_T = S \cdot \exp\left((r - \frac{\sigma^2}{2})T + \sigma\sqrt{T} \cdot Z\right)

where Z ~ N(0, 1) is a standard normal random variable.

Monte Carlo Algorithm

  1. For each of n_paths simulations:
    • Sample Z from N(0,1)
    • Compute STS_T using the formula above
    • Calculate the payoff: max(S_T - K, 0)
  2. Average all payoffs
  3. Discount at risk-free rate: CerTmean payoffC \approx e^{-rT} \cdot \text{mean payoff}

Generating Normal Samples: Box-Muller

To generate standard normal samples from uniform random numbers:

Z1=2lnU1cos(2πU2)Z_1 = \sqrt{-2\ln U_1} \cos(2\pi U_2) Z2=2lnU1sin(2πU2)Z_2 = \sqrt{-2\ln U_1} \sin(2\pi U_2)

where U₁, U₂ are independent Uniform(0,1).

Accuracy

With n_paths = 10,000, the standard error is roughly σ/√n ≈ 1% of the price. More paths = more accuracy but slower computation.

Python runtime loading...
Loading...
Click "Run" to execute your code.