← Back to Home
Monte Carlo Simulations with Geometric Brownian Motion

Monte Carlo Simulations with Geometric Brownian Motion

­­Monte Carlo Simulation

Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. In finance they have a wide range of applications in corporate finance, valuation of options and equities, valuation of fixed-income securities, portfolio evaluation, Value at Risk, portfolio stress testing, portfolio optimization, asset allocation, credit risk modeling, etc.

Geometric Brownian Motion (GBM)

The GBM model for the evolution of an asset price \(S(t)\) is described by the stochastic differential equation (SDE):

\[dS(t) = \mu S(t) dt + \sigma S(t) dW(t)\]

Where:

   At each time step \(i\), simulate the next price \(S(t_i)\) using the GBM formula:

\[S(t_{i+1}) = S(t_i) \cdot e^{(\mu - \frac{\sigma^2}{2}) \Delta t + \sigma \sqrt{\Delta t} Z_i}\]

   Where \(Z_i\) is a random sample from a standard normal distribution.


Python Code for Monte Carlo Simulation of GBM

 import numpy as np
import matplotlib.pyplot as plt

def monte_carlo_gbm(S0, mu, sigma, T, N, num_paths):
    dt = T / N
    paths = np.zeros((N+1, num_paths))
    paths[0, :] = S0

    for i in range(1, N+1):
        Z = np.random.normal(0, 1, num_paths)
        paths[i, :] = paths[i-1, :] * np.exp((mu - 0.5 * sigma**2) * dt 
                        + sigma * np.sqrt(dt) * Z)

    return paths

# Example parameters
S0 = 100   # Initial price
mu = 0.05  # Drift
sigma = 0.2  # Volatility
T = 1.0    # Time to maturity
N = 252    # Number of time steps (daily observations)
num_paths = 10

# Perform Monte Carlo simulation
paths = monte_carlo_gbm(S0, mu, sigma, T, N, num_paths)

# Plot the simulated paths
plt.figure(figsize=(10, 6))
plt.plot(np.linspace(0, T, N+1), paths, lw=1)
plt.title('Monte Carlo Simulation of GBM')
plt.xlabel('Time')
plt.ylabel('Asset Price')
plt.show()
Pasted image 20250315222201.png

Applications and Use Cases

1. Option Pricing and Derivative Valuation:
Monte Carlo methods are extensively used to price complex derivatives where closed-form solutions are difficult or impossible to obtain. By simulating the underlying asset price using GBM, you can estimate the expected payoff of options and other derivatives. This is particularly useful for exotic options or path-dependent options like Asian options, where the payoff depends on the entire price path.

2. Risk Management and Value at Risk (VaR):
Financial institutions use Monte Carlo simulations to assess the risk of their portfolios. By generating a large number of possible future market scenarios, risk managers can compute risk metrics such as Value at Risk (VaR) or Conditional Value at Risk (CVaR). These metrics help quantify the potential losses in adverse market conditions.

3. Portfolio Optimization and Asset Allocation:
Monte Carlo techniques help in understanding how portfolios might evolve over time under uncertain market conditions. They allow investors to simulate different asset allocation strategies, measure the performance and risk of portfolios, and ultimately guide decisions for diversification and optimization.

4. Credit Risk Modeling:
In credit risk, simulations are used to model default probabilities and losses in the event of defaults. By simulating a range of economic scenarios and their impacts on borrowers’ ability to repay loans, financial institutions can better assess credit risk and structure appropriate capital reserves.

5. Stress Testing and Scenario Analysis:
Beyond risk metrics, Monte Carlo simulations facilitate stress testing by modeling extreme but plausible market events. This approach is useful for regulatory requirements and internal risk assessments to ensure that financial institutions can withstand significant market shocks.

6. Corporate Finance and Capital Budgeting:
Companies often employ Monte Carlo simulations to evaluate the uncertainty in cash flows and investment returns. This helps in making informed decisions on capital budgeting, project evaluation, and strategic planning under uncertain economic conditions.

7. Applications Beyond Finance:
While finance is a primary field, Monte Carlo simulations and GBM models are also applicable in various other domains such as: