Simulating Stock Price
The movement of stock prices are generally considered to be a random walk which are very difficult to accurately forecast. Because of the randomness associated with stock price movements, they need to be simulated using Stochastic Differential Equations (SDE). Geometric Brownian Motion (GBM) is one of the most common models for simulating the dynamics of stock prices because of the following properties:
- Log-Normal random path meaning that the simulated stock price cannot become negative;
- There is a drift and diffusion component which can be calibrated to historical rates;
- Closed-form solutions exist which makes simulating forward paths computationally efficient.
The equation for Geometric Brownian Motion is
\[dS_t = \mu S_t dt + \sigma S_t dW_t\]where \(S\) is the stock price, \(\mu\) is the drift coefficient, \(\sigma\) is the diffusion coefficient, and \(W_t\) is the Brownian Motion.
Brownian Motion
In order to simulate stock prices using the GBM model, we first need to model the Brownian Motion. This is done by first sampling random variates from a standard normal distribution \(N(0,1)\) to calculate the Brownian increments. The Brownian Path is then determined by taking the cumulative sum of the Brownian Increments. The code below demonstrates how this can be implemented in Python.
TBC