Simulating Geometric Brownian Motion in Python | Quantitative Finance Tutorial

Added:

Stochastic Volatility and Jump-Diffusion Models

While Geometric Brownian Motion (GBM) is a foundational stochastic process in quantitative finance, it relies on highly unrealistic assumptions, such as constant volatility and continuous price paths. Real-world financial markets frequently exhibit 'fat tails' (extreme events occurring more often than a log-normal distribution predicts), volatility clustering, and sudden asset price jumps. To address these limitations, modern quantitative finance utilizes alternative models. Stochastic Volatility models, such as the Heston model, treat volatility as a dynamic, random variable rather than a constant. Jump-Diffusion models, like Merton's model, incorporate discontinuous 'jumps' to simulate sudden market shocks and crashes. Additionally, Fractional Brownian Motion is employed to model market dependency and long-term memory, directly challenging GBM's assumption of independent increments. Relying solely on GBM can lead to a severe underestimation of extreme risk and the systematic mispricing of financial derivatives.

Intermediate Python programming skills, particularly using scientific computing libraries like NumPy for array operations and Matplotlib for data visualization.
Basic probability and statistics, specifically concepts like the normal distribution, random walks, and mean/variance.
An introductory understanding of continuous-time stochastic processes, particularly the standard Brownian Motion (Wiener process).
Fundamental quantitative finance concepts, such as asset returns, drift, volatility, and the assumption of log-normal stock price distributions.
Applying simulated Geometric Brownian Motion paths to price derivative contracts using Monte Carlo simulation (e.g., pricing European Options).
Parameter estimation and calibration techniques to extract historical drift and volatility parameters from real-world financial market data.
Exploring more advanced stochastic asset pricing models that address the limitations of GBM, such as the Heston Stochastic Volatility model or Jump-Diffusion models.
Implementing financial risk management frameworks, such as calculating Value at Risk (VaR) and Expected Shortfall (ES) using simulated portfolios.
44.4K views992likes8:48@QuantPyOriginal Release: 2021-09-15

Geometric Brownian motion is a stochastic process used to model stock prices, where the logarithm of the stock price follows a normal distribution with mean μt and variance σ²t; it can be simulated in Python using numpy by calculating the drift term (μ - σ²/2) × dt, generating random normal samples scaled by √(dt), and applying the cumulative product to accumulate changes over time, with the final stock price given by S₀ × exp[(μ - σ²/2) × t + σ × W(t)], where W(t) represents the Brownian motion component.