Mastering Quantitative Finance
Stochastic Calculus Foundations
The Random Walk of Markets
To model asset prices, we need a way to describe randomness that unfolds over time. The fundamental building block for this is the Wiener process, often called Brownian motion. It's the mathematical formalization of a continuous random walk.
A standard is defined by three key properties:
- It starts at zero: .
- Its movements over non-overlapping time intervals are independent. The path it takes from today to tomorrow has no memory of the path it took from yesterday to today.
- The change over any time interval, , is normally distributed with a mean of 0 and a variance equal to the time elapsed, . In notation, .
These properties lead to some strange and powerful results. The path of a Wiener process is continuous everywhere, but differentiable nowhere. It’s a line so jagged that you can't draw a tangent to it at any point. This feature makes it a much better model for volatile market prices than the smooth curves of traditional calculus.
A New Kind of Calculus
Because the Wiener process isn't differentiable, the familiar rules of calculus don't apply. If you have a function that depends on this random process, you can't use the standard chain rule to find its differential, . We need a new tool.
This is where Itô's Lemma comes in. It's the chain rule of stochastic calculus, designed specifically for functions of stochastic processes like the Wiener process.
The key insight comes from how infinitesimals behave. In standard calculus, terms like are considered so small they become zero. In stochastic calculus, they are not. Because the variance of a change in is , we have a crucial, non-intuitive relationship: . This random term's squared change doesn't vanish; it's proportional to the change in time. accounts for this by adding an extra term to the standard chain rule.
This extra term, involving the second derivative (like convexity), captures the impact of the process's inherent randomness. It fundamentally changes how we model the evolution of functions of random variables.
Modeling Stock Prices
Now we can build a realistic model for a stock price, . We don't model the price directly, but rather its percentage change. We assume the price has a deterministic drift (its expected return) and a random, volatile component. This gives us a Stochastic Differential Equation (SDE).
This is the SDE for Geometric Brownian Motion (GBM), the workhorse model for equity prices. To find an equation for the stock price itself, we need to solve this SDE. We can't just integrate it like a normal differential equation; we must use Itô's Lemma.
By applying Itô's Lemma to the function , we can derive the solution for :
This equation is powerful. It gives us a way to describe the entire future path of a stock price based on its initial price, expected return, volatility, and a source of randomness.
Simulating Price Paths
While the equation for GBM gives us the exact price at a future time , it's often more useful to simulate the entire price path. We can do this by discretizing the SDE. We'll simulate small, discrete time steps and build the path step-by-step. The random shocks for each step will be drawn from a normal distribution.
import numpy as np
import matplotlib.pyplot as plt
def simulate_gbm(S0, mu, sigma, T, N):
"""
Simulates Geometric Brownian Motion price paths.
S0: Initial stock price
mu: Expected annual return (drift)
sigma: Annual volatility
T: Time horizon in years
N: Number of time steps
"""
dt = T / N # Time step size
t = np.linspace(0, T, N+1)
# Generate random shocks from a standard normal distribution
# W = sqrt(dt) * Z, where Z ~ N(0, 1)
W = np.random.standard_normal(size=N+1)
W = np.cumsum(W) * np.sqrt(dt)
# GBM formula
exponent = (mu - 0.5 * sigma**2) * t + sigma * W
St = S0 * np.exp(exponent)
return t, St
# --- Simulation Parameters ---
S0 = 100 # Initial price
mu = 0.05 # 5% expected return
sigma = 0.20 # 20% volatility
T = 1.0 # 1 year horizon
N = 252 # Number of trading days in a year
# --- Run and Plot Simulation ---
plt.figure(figsize=(10, 6))
for _ in range(5):
t, St = simulate_gbm(S0, mu, sigma, T, N)
plt.plot(t, St)
plt.title('GBM Price Path Simulations')
plt.xlabel('Time (Years)')
plt.ylabel('Stock Price')
plt.grid(True)
plt.show()
This Python code uses NumPy to generate multiple possible price paths. Each simulation run produces a different path because the random shocks drawn from the normal distribution are unique each time. This technique, known as Monte Carlo simulation, is essential for pricing complex derivatives and managing risk.
Ready to test your understanding? This quiz covers the core ideas of stochastic calculus we've discussed.
A standard Wiener process, , is a fundamental model for random movement over time. According to its definition, what is the statistical distribution of an increment (for )?
Which of the following statements best describes the path of a Wiener process?
Mastering these concepts—the Wiener process, Itô's Lemma, and GBM—provides the essential mathematical machinery for modern quantitative finance.