Calculate European option prices through Monte Carlo simulation of Geometric Brownian Motion (GBM) stock price paths.

The Monte Carlo method prices an option by simulating a large number of possible future paths for the underlying stock price under the risk-neutral measure, computing the option’s payoff at expiration for each simulated path, and then discounting the average payoff back to the present:

  • S(t + Δt) = S(t) * e^((r - q - σ²/2) * Δt + σ * √Δt * Z)
  • Call Price = e^(-r * T) * mean(max(S(T) - K, 0))
  • Put Price = e^(-r * T) * mean(max(K - S(T), 0))

Where S(t) is the stock price at time t, r is the risk-free rate, q is the dividend yield, σ is the volatility, Δt is the length of a single time step and Z is a standard normal random variable.

As it is a simulation, the result comes with sampling error. Set show_standard_error=True to additionally return the standard error of each estimate - as a rule of thumb, the true price lies within plus or minus 2 times the standard error roughly 95% of the time. A fixed seed is used by default for reproducibility of documentation examples; set it explicitly (or leave it as None) to control this behavior.

Also known as: Monte Carlo option pricing, simulation-based option pricing.

Monte Carlo Option Price in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_monte_carlo_option_price as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "AAPL"], api_key="FINANCIAL_MODELING_PREP_KEY")

monte_carlo = toolkit.options.get_monte_carlo_option_price(seed=42)

monte_carlo.loc['AMZN']

Parameters

The function accepts the following parameters:

  • start_date (str | None, optional): The start date which determines the stock price. Defaults to None which means it will use the most recent date.
  • put_option (bool, optional): Whether to calculate the put option price. Defaults to False which means it will calculate the call option price.
  • strike_price_range (float): The percentage range to use for the strike prices. Defaults to 0.25 which equals 25% and thus results in strike prices from 75 to 125 if the current stock price is 100.
  • strike_step_size (int): The step size to use for the strike prices. Defaults to 5 which means that the strike prices will be 75, 80, 85, 90, 95, 100, 105, 110, 115 and 120 if the current stock price is 100.
  • expiration_time_range (int): The number of days to use for the time to expiration. Defaults to 30 which equals 30 days.
  • risk_free_rate (float, optional): The risk free rate to use for the calculation. Defaults to None which means it will use the current risk free rate.
  • dividend_yield (float, optional): The dividend yield to use for the calculation. Defaults to None which means it will use the dividend yield as obtained through annual historical data.
  • simulations (int, optional): The number of simulated stock price paths. Defaults to 10,000.
  • time_steps (int, optional): The number of time steps used to build each simulated path. Defaults to 100.
  • seed (int | None, optional): The seed used to initialize the random number generator, ensuring reproducible results. Defaults to None, which means the results will not be reproducible.
  • show_standard_error (bool, optional): Whether to also return the standard error of each Monte Carlo estimate as a second DataFrame. Defaults to False.
  • show_input_info (bool, optional): Whether to show the input information. Defaults to False.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
  • standardize (bool, optional): Whether to standardize (Z-Score) the result across the time to expiration columns for each ticker and strike price. Defaults to False.
Share