Skip to content

Stochastic Calculus for Trading

Difficulty beginner

Overview

Stochastic calculus provides the mathematical framework for modeling continuous-time random processes, essential for derivatives pricing and advanced quantitative finance.

Brownian Motion

Standard Brownian Motion (Wiener Process)

Properties: 1. W₀ = 0 2. Continuous paths 3. Independent increments 4. W_t - W_s ~ N(0, t-s) for t > s

Geometric Brownian Motion (GBM)

dS_t = μS_t dt + σS_t dW_t

Solution:
S_t = S₀ × exp((μ - σ²/2)t + σW_t)

Where:
μ = drift (expected return)
σ = volatility
W_t = Brownian motion

where: dS_t infinitesimal change in price · μS_t dt deterministic drift component · σS_t dW_t random shock proportional to current price · W_t standard Brownian motion · −σ²/2 Itô correction (makes E[S_t] = S₀·e^{μt}). does: the workhorse model for asset prices. Guarantees S stays positive (multiplicative noise), gives log-normal price distribution, and underlies Black-Scholes options pricing.

Itô's Lemma

Statement

For a function f(t, X_t) where dX_t = a dt + b dW_t:

df = (∂f/∂t + a∂f/∂x + ½b²∂²f/∂x²)dt + b∂f/∂x dW_t

Key insight: Second-order term (½b²∂²f/∂x²) matters because (dW_t)² = dt

where: f(t, X_t) smooth function of time and a stochastic process · a, b drift and diffusion coefficients of dX_t · ∂f/∂t, ∂f/∂x partial derivatives · ∂²f/∂x² second derivative. does: the chain rule for stochastic processes. The extra ½b²f″ term arises because Brownian increments accumulate variance linearly in time — ignoring it gives wrong prices.

Application: Deriving Black-Scholes

For option price C(S,t) with GBM stock:

dC = (∂C/∂t + μS∂C/∂S + ½σ²S²∂²C/∂S²)dt + σS∂C/∂S dW_t

where: C(S,t) option price as a function of underlying S and time t · ∂C/∂t theta · ∂C/∂S delta · ∂²C/∂S² gamma · μ, σ underlying drift and volatility. does: Itô's lemma applied to an option whose underlying follows GBM. Setting up a delta-hedged portfolio cancels the random dW term — the deterministic remainder yields the Black-Scholes PDE.

Itô Integral

Definition

∫₀ᵗ f(s, W_s) dW_s = lim Σ f(tᵢ, W_{tᵢ})(W_{tᵢ₊₁} - W_{tᵢ})

Evaluated at left endpoint (non-anticipating).

where: f(s, W_s) integrand depending on time s and Brownian motion W_s · summation is a Riemann-style sum over a partition {tᵢ} of [0, t] · "left endpoint" evaluates f at the start of each sub-interval — this prevents the integrand from peeking at future randomness. does: defines integration against Brownian motion. The left-endpoint choice is what makes it well-defined and gives clean martingale properties; using the right endpoint would give the Stratonovich integral instead.

Key Properties

E[∫₀ᵗ f dW] = 0
Var[∫₀ᵗ f dW] = E[∫₀ᵗ f² ds]  (Itô isometry)

where: E[·] expectation · Var[·] variance · the first identity says Itô integrals are martingales (zero drift); the second (Itô isometry) gives the variance directly from the deterministic integral of f². does: the two workhorse properties that let you compute moments of stochastic integrals without simulating paths. Used constantly in derivatives pricing.

Stochastic Differential Equations (SDEs)

General Form

dX_t = μ(t, X_t)dt + σ(t, X_t)dW_t

where: dX_t infinitesimal change in state · μ(t, X_t) drift coefficient (can depend on time and current state) · σ(t, X_t) diffusion coefficient · dW_t increment of standard Brownian motion. does: the general form of a one-dimensional SDE. By choosing μ and σ you specify the dynamics; specific examples are tabulated below (GBM, OU, CIR, Heston).

Common SDEs in Finance

Model SDE Use
GBM dS = μS dt + σS dW Stock prices
Ornstein-Uhlenbeck dX = θ(μ-X)dt + σ dW Mean-reverting processes
CIR dr = a(b-r)dt + σ√r dW Interest rates (positive)
Heston dS = μS dt + √v S dW₁ Stochastic volatility
dv = κ(θ-v)dt + ξ√v dW₂

Ornstein-Uhlenbeck Process

dX_t = θ(μ - X_t)dt + σ dW_t

θ = speed of mean reversion
μ = long-term mean
σ = volatility

Solution:
X_t = μ + (X₀ - μ)e^{-θt} + σ∫₀ᵗ e^{-θ(t-s)} dW_s

Mean: E[X_t] = μ + (X₀ - μ)e^{-θt}
Variance: Var[X_t] = σ²/(2θ)(1 - e^{-2θt})

where: θ(μ − X_t) restoring force proportional to distance from the long-term mean · σ dW_t constant-amplitude random shock · X₀ starting value · half-life of reversion = ln(2)/θ. does: the canonical mean-reverting process — the basis for pairs trading, interest-rate models, vol-of-vol modeling, and any "elastic band" stochastic dynamics. Variance approaches the stationary value σ²/(2θ) as t→∞.

Martingales

Definition

A process M_t is a martingale if:

E[M_{t+1} | M₀, M₁, ..., M_t] = M_t

Best prediction of future value is current value

where: M_t value of the process at time t · E[·|M₀,…,M_t] conditional expectation given the full path so far · the conditioning is on the natural filtration of M. does: formalizes a "fair game" — the expected future value, given everything you know, is just where you stand now. Discounted asset prices are martingales under the risk-neutral measure.

Risk-Neutral Pricing

Under risk-neutral measure Q:

Discounted asset prices are martingales

E^Q[e^{-rT}S_T | F_t] = e^{-rt}S_t

This implies: E^Q[S_T] = S_t × e^{r(T-t)}

where: E^Q[·|F_t] expectation under the risk-neutral probability measure Q conditional on information available at time t · e^{-rT} discount factor at the risk-free rate · F_t filtration (history up to time t). does: under Q, the expected discounted price equals today's price — the cornerstone of arbitrage-free derivative pricing. Switching from the real-world measure P to Q replaces expected return with the risk-free rate.

Trading Implication

In efficient markets, price changes are approximately martingale differences (no predictable pattern).

Feynman-Kac Formula

Connects SDEs to PDEs:

If u(t,x) = E^Q[f(X_T) | X_t = x]

Then u satisfies:
∂u/∂t + L u - ru = 0

Where L is the generator of the diffusion

where: u(t,x) value function (e.g. option price as a function of time and underlying) · f(X_T) terminal payoff · L the infinitesimal generator of the diffusion X (for GBM: L = μx ∂/∂x + ½σ²x² ∂²/∂x²) · r risk-free rate. does: turns a conditional-expectation problem (averaging over many simulated paths) into a deterministic PDE. The bridge between Monte Carlo and analytic pricing — and the formal route from "expected payoff under Q" to the Black-Scholes PDE.

This is the theoretical foundation of the Black-Scholes PDE.

Quadratic Variation

Definition

[X]_t = lim Σ (X_{tᵢ₊₁} - X_{tᵢ})²

For Brownian motion: [W]_t = t
For GBM: [S]_t = ∫₀ᵗ σ²S²_s ds

where: [X]_t quadratic variation of process X up to time t · the sum is taken as the partition mesh → 0 · for ordinary (smooth) functions, quadratic variation is zero — for Brownian-driven processes it accumulates linearly. does: measures how much a path "wiggles" in a path-by-path sense (not an average). The fact that [W]_t = t (deterministically, almost surely) is what makes Itô calculus genuinely different from ordinary calculus.

Girsanov's Theorem

Statement

Change of measure alters drift but not volatility:

Under P: dX_t = μ dt + σ dW^P_t
Under Q: dX_t = (μ - λσ) dt + σ dW^Q_t

Where λ is the market price of risk

where: P real-world (physical) probability measure · Q equivalent measure (here, risk-neutral) · W^P, W^Q Brownian motions under each measure · λ = (μ − r)/σ the market price of risk (Sharpe ratio of the underlying). does: lets you switch probability measures without changing the diffusion coefficient — only the drift shifts. The mechanism behind risk-neutral pricing: under Q, every asset earns the risk-free rate.

Application: Risk-Neutral Valuation

Real-world measure P: dS = μS dt + σS dW^P
Risk-neutral measure Q: dS = rS dt + σS dW^Q

Only drift changes (μ → r), volatility stays σ

where: P real-world measure (uses actual expected return μ) · Q risk-neutral measure (uses risk-free rate r) · W^P, W^Q Brownian motions under each measure related by Girsanov · σ instantaneous volatility, invariant under the change of measure. does: rewrites GBM under Q so prices grow at the risk-free rate. Every derivative price collapses to E^Q[discounted payoff] — the operational form of risk-neutral pricing.

Local Volatility and Stochastic Volatility

Local Volatility (Dupire)

σ_local(K,T) = √[2 × ∂C/∂T / (K² × ∂²C/∂K²)]

Volatility as function of strike and maturity

where: σ_local(K,T) local volatility at strike K and maturity T · C call price · ∂C/∂T calendar-spread sensitivity · ∂²C/∂K² butterfly-spread sensitivity (proportional to the implied risk-neutral PDF of price at T). does: Dupire's formula — recovers the deterministic local-volatility function σ(S,t) that makes the model exactly fit all observed European option prices. Used to price exotic options consistently with the vanilla market.

Stochastic Volatility (Heston)

dS_t = μS_t dt + √v_t S_t dW¹_t
dv_t = κ(θ - v_t)dt + ξ√v_t dW²_t
dW¹_t × dW²_t = ρ dt

v_t = instantaneous variance
κ = mean reversion speed
θ = long-term variance
ξ = vol of vol
ρ = correlation between asset and vol

where: the second equation is a CIR process for the variance v_t · √v_t S_t makes the spot's diffusion depend on the current (random) variance · dW¹ × dW² = ρ dt couples spot and variance shocks · ρ typically negative for equities (leverage effect). does: Heston model — gives stochastic volatility (vol mean-reverts to θ at speed κ) while keeping closed-form European pricing via characteristic functions. Reproduces the equity vol smile far better than Black-Scholes.

Key Formulas Reference

GBM: dS = μS dt + σS dW
Itô: df = (∂f/∂t + a∂f/∂x + ½b²∂²f/∂x²)dt + b∂f/∂x dW
OU: dX = θ(μ-X)dt + σ dW
OU Half-life: ln(2)/θ
Realized Vol: √(Σr²) × √(252/N)
GBM Solution: S_t = S₀ exp((μ-σ²/2)t + σW_t)

Next Steps