Geometric Brownian Motion in Practice Simulating Apple Price Paths

A practical introduction to stochastic processes and Ito calculus, I model Apple prices with a Geometric Brownian Motion, estimate drift and volatility from log returns, and generate Monte Carlo scenarios with a reproducible Python script.

Stochastic processes Ito calculus GBM AAPL Python ⏱ 8 min 🗓 Apr 22, 2026
Bytes In Finance Logo
by BytesInFinance
Quant models • Time series

1. From deterministic to stochastic models

In many areas of science, a system is described by a differential equation, a rule that tells you how a variable evolves over time. In finance, the variable is often a price S(t). A purely deterministic equation would imply that, once you know the initial value and the parameters, the future path is fixed.

Markets do not behave like that. News, order flow, liquidity, and sentiment introduce uncertainty that cannot be summarized by a single predictable curve. This is why quantitative finance often replaces a deterministic differential equation with a stochastic differential equation, where the evolution contains a systematic component and a random component.

Disclaimer: This content is educational and descriptive. It is not investment advice. Market data and simulations can be misleading if taken out of context.

2. The Ito process: drift and randomness

A common building block is the Ito process. Conceptually, it splits the evolution of a variable into two parts:

  • Deterministic part (drift): the average direction of motion over time, the component you would keep even in a calm and perfectly predictable world.
  • Random part (diffusion): the unpredictable shocks that push the variable up or down, modeled through a Brownian motion term.

In continuous time, this idea is written as a stochastic differential equation. The Brownian motion increment is the mathematical tool that makes the random part behave in a specific way, small shocks are common, large shocks are rare, and the noise accumulates over time.

3. Geometric Brownian Motion intuition

The Geometric Brownian Motion is the most famous stochastic model for prices and it is the dynamic assumption behind the Black Scholes Merton framework. In its classic form it states that price changes are proportional to the current price level.

GBM in words

The price has an average growth component and a random shock component. Both act on the price in a multiplicative way, which keeps prices positive. Under this model, log returns behave like a normal distribution over small time steps, and prices become log normal.

The parameter that controls the average direction is the drift, while the parameter that controls the size of typical random shocks is volatility. In simulations, the random shock is generated through a standard normal variable Z. Most of the time Z is close to zero, sometimes it is around two or minus two, and very rarely it takes larger values.

4. Discretization for simulations

The model is defined in continuous time, but real data is sampled daily. For that reason I simulate the process with daily steps. The key idea is simple, at each day I add a deterministic contribution and a random contribution to the log return, then I exponentiate to update the price.

Simulation step (conceptual)

Each day: log return = average daily log return + daily volatility times a standard normal draw. Then the new price is the old price times the exponential of that log return.

5. Parameter estimation on Apple

I apply the workflow to Apple (AAPL) using adjusted close prices up to the end of 2025. I compute daily log returns and estimate: the mean of log returns and the standard deviation of log returns. These two quantities become the deterministic and random scale used in the Monte Carlo engine.

  • m daily: average daily log return, used as the deterministic component.
  • s daily: standard deviation of daily log returns, used as the volatility scale for the random component.
  • S0: the last observed adjusted close price, used as the starting point for simulations.
  • N steps: 252 trading days, about one market year.
  • N paths: 20 trajectories, a compact set of scenarios for visualization.
  • seed: a fixed value that makes the pseudorandom draws reproducible.

6. Python implementation

Below is the essential code used to estimate parameters from log returns and simulate a Geometric Brownian Motion. The function generates Z from a standard normal distribution and updates the price with a multiplicative exponential step.

import numpy as np
import yfinance as yf

def simulate_gbm_from_logrets(S0, m_daily, s_daily, n_steps, n_paths, seed=42):
    rng = np.random.default_rng(seed)
    S = np.empty((n_steps + 1, n_paths), dtype=float)
    S[0] = S0
    for t in range(1, n_steps + 1):
        Z = rng.standard_normal(n_paths)
        S[t] = S[t - 1] * np.exp(m_daily + s_daily * Z)
    return S

TICKER = "AAPL"
START = "2010-01-01"
END_EXCLUSIVE = "2026-01-01"
N_STEPS = 252
N_PATHS = 20
SEED = 42

close = yf.download(TICKER, start=START, end=END_EXCLUSIVE,
                    auto_adjust=True, progress=False)["Close"].squeeze().dropna()

logrets = np.log(close / close.shift(1)).dropna()
m_daily = float(logrets.mean())
s_daily = float(logrets.std(ddof=0))
S0 = float(close.iloc[-1])

paths = simulate_gbm_from_logrets(S0, m_daily, s_daily, N_STEPS, N_PATHS, seed=SEED)
mean_path = paths.mean(axis=1)

The plot then overlays all simulated paths and the mean trajectory across paths. The mean is not a forecast, it is a summary of the Monte Carlo ensemble.

7. Results and interpretation

Geometric Brownian Motion simulation for Apple with multiple paths and mean trajectory
GBM simulation for AAPL with 20 Monte Carlo paths and the mean trajectory. Credit: bytesinfinance.com.

The fan shape is the main visual message, uncertainty accumulates over time. In the short run the paths remain close because only a few daily shocks have been applied. As days pass, random shocks compound multiplicatively and the dispersion increases. The mean trajectory is smoother than individual paths because it averages independent shocks across scenarios.

8. Limits of the model

GBM is a baseline model. It is useful because it is simple, continuous, and mathematically tractable, but it also has well known limitations:

  • Constant volatility: real markets show volatility clustering and regime changes.
  • Normal log returns: empirical returns often have fat tails and asymmetry.
  • No jumps: earnings, macro news, and gaps are not captured by a pure diffusion model.
  • Independence: the model assumes independent increments, while markets can show dependence in higher moments.

In practice, the value of this exercise is not to claim perfect realism. The value is to build intuition and create a reproducible baseline that can be extended later with stochastic volatility, jump diffusion, or regime switching models.

9. Methodology and reproducibility

  • Asset: AAPL adjusted close prices.
  • Sample: 2010 to end of 2025.
  • Returns: daily log returns.
  • Parameters: mean and standard deviation of log returns estimated from the sample.
  • Simulation: 252 daily steps, 20 paths, fixed seed for reproducibility.
  • Output: path fan and mean trajectory for visual interpretation.

Educational content only, not investment advice.

Stay in the loop

Quant insights, scripts, and indicators - at most 1 or 2 emails per month.