The Claude Quant PlaybookDownload ebookDownload ebook

Geometric Brownian motion

advancedOptions12 of 14

The standard model of a stock price: returns are random and normal over short intervals, so the price itself is log-normal and never goes below zero.

Build a trading system with Claude.Download ebook

01The formula

price at time t
drift: expected return per year
volatility per year
Brownian motion: a random walk in continuous time, normal with variance t

02See it move

03Where it is used

04Why traders use it

It captures the two facts every trader lives with: prices compound, and uncertainty grows with the square root of time.

05Worked example

A $100 stock with μ = 8% and σ = 25% has an expected price of $108.33 in a year, but a median of only $105.00: most paths end below the average, because a few big winners pull the average up.

06How it is built

  1. Take logs. By Itô's lemma, .
  2. Integrate: , a normal variable.
  3. So is log-normal, with and median .

07The common mistake

Forgetting the . It is why a volatile asset with a positive average return can still lose money for the typical investor.

08In Python and LaTeX

import numpy as np
rng = np.random.default_rng(7)
S0, mu, sigma, n, steps = 100, 0.08, 0.25, 40, 100
dt = 1/steps
Z = rng.standard_normal((n, steps))
paths = S0*np.exp(np.cumsum((mu-sigma**2/2)*dt + sigma*np.sqrt(dt)*Z, axis=1))
print(paths[:, -1].mean(), np.median(paths[:, -1]))
dS_t = \mu S_t\,dt + \sigma S_t\,dW_t \;\Rightarrow\; S_t = S_0\, e^{(\mu - \frac12\sigma^2)t + \sigma W_t}

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.