Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Stock Price Simulation Using Geometric Brownian Motion, Summaries of Applied Statistics

Stock prices are one of the most random entities . Geometric Brownian Motion (GBM) is one of the most popular methods for simulating stock prices. It is based on the Brownian motion model, which describes the random motion of particles suspended in a fluid. Python code for actual simulation is also provided.

Typology: Summaries

2022/2023

Available from 10/05/2023

sajadjnu
sajadjnu 🇮🇳

4 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Simulating Stock Prices using Geometric
Brownian Motion
October 5, 2023
Sajad Ahmad Sheikh,University of Kashmir
1 Introduction
Geometric Brownian Motion (GBM) is one of the most popular methods for simulating stock prices. It
is based on the Brownian motion model, which describes the random motion of particles suspended in a
fluid.
2 Mathematical Model
The GBM model for stock prices is given by the stochastic differential equation:
dSt=µStdt +σStdWt
Where:
Stis the stock price at time t
µis the expected return (drift)
σis the volatility
dWtis a Wiener process or Brownian motion
The solution to this equation is:
St=S0exp µ
σ2
2t+σWt
3 Algorithm for Simulating Stock Prices
1. Initialize the stock price S0, expected return µ, volatility σ, and time increment t.
2. For each time step tuntil the desired time horizon:
Generate a random number Zfrom a standard normal distribution.
Calculate the change in stock price Susing the formula:
S=µStt+σStZt
Update the stock price: St+∆t=St+ S
3. Repeat the above steps for multiple simulations to generate different stock price paths.
4 Significance
Risk Assessment: By simulating various stock price paths, we can assess the potential risk
associated with a stock.
Option Pricing: GBM is fundamental in the Black-Scholes option pricing model.
Portfolio Optimization: Simulating stock prices helps in optimizing portfolio allocations.
1
pf2

Partial preview of the text

Download Stock Price Simulation Using Geometric Brownian Motion and more Summaries Applied Statistics in PDF only on Docsity!

Simulating Stock Prices using Geometric

Brownian Motion

October 5, 2023

Sajad Ahmad Sheikh,University of Kashmir

1 Introduction

Geometric Brownian Motion (GBM) is one of the most popular methods for simulating stock prices. It

is based on the Brownian motion model, which describes the random motion of particles suspended in a

fluid.

2 Mathematical Model

The GBM model for stock prices is given by the stochastic differential equation:

dSt = μStdt + σStdWt

Where:

  • St is the stock price at time t
  • μ is the expected return (drift)
  • σ is the volatility
  • dWt is a Wiener process or Brownian motion

The solution to this equation is:

St = S 0 exp

σ^2

t + σWt

3 Algorithm for Simulating Stock Prices

1. Initialize the stock price S 0 , expected return μ, volatility σ, and time increment ∆t.

2. For each time step t until the desired time horizon:

  • Generate a random number Z from a standard normal distribution.
  • Calculate the change in stock price ∆S using the formula:

∆S = μSt∆t + σStZ

∆t

  • Update the stock price: St+∆t = St + ∆S

3. Repeat the above steps for multiple simulations to generate different stock price paths.

4 Significance

  • Risk Assessment: By simulating various stock price paths, we can assess the potential risk

associated with a stock.

  • Option Pricing: GBM is fundamental in the Black-Scholes option pricing model.
  • Portfolio Optimization: Simulating stock prices helps in optimizing portfolio allocations.

Python Code for Simulating Stock Prices using GBM

1 import numpy as np 2 import matplotlib. pyplot as plt 3 4 def simulate_stock_prices ( S0 , mu , sigma , dt , T ) : 5 """ 6 Simulate stock prices using Geometric Brownian Motion. 7 8 Parameters : 9 - S0 : Initial stock price 10 - mu : Expected return ( drift ) 11 - sigma : Volatility 12 - dt : Time increment 13 - T : Total time horizon 14 15 Returns : 16 - A numpy array containing simulated stock prices. 17 """ 18 N = int ( T / dt ) 19 t = np. linspace (0 , T , N ) 20 W = np. random. standard_normal ( size = N ) 21 W = np. cumsum ( W ) * np. sqrt ( dt ) # Cumulative sum to generate Brownian motion 22 S = S0 * np. exp (( mu - 0.5 * sigma **2) * t + sigma * W ) 23 return S 24 25 # Parameters 26 S0 = 100 27 mu = 0. 28 sigma = 0. 29 dt = 0. 30 T = 1 31 32 # Simulate stock prices 33 stock_prices = simulate_stock_prices ( S0 , mu , sigma , dt , T ) 34 35 # Plot 36 plt. plot ( stock_prices ) 37 plt. title ( ’ Simulated Stock Prices using GBM ’) 38 plt. xlabel ( ’ Time Steps ’) 39 plt. ylabel ( ’ Stock Price ’) 40 plt. show ()