Fill This Form To Receive Instant Help
Homework answers / question archive / FIN5615 Project #2 Random Walk Simulaton (Part I) Project Introduction In this project we will try to address some of the shortcomings of modeling stock price as a simple random walk
Random Walk Simulaton (Part I)
Project Introduction
In this project we will try to address some of the shortcomings of modeling stock price as a simple random walk. We will compare the simulated option prices from our random walk model against that of the Black-Scholes options pricing formula.
Instructions
Please code you solutions directly in this Notebook under each task in the cells provided below. Include all code used to produce your results, and support your answers with textual explanations if neccessary. You may feel free to add additional Code and/or Markdown cells as needed. Code must be written using Python 3.
Please order the cells in your Notebook in the order in which they are intended to run! It is expected that your Notebook is able to run in sequence from start to finish without any errors (before submitting check by: Kernel > Restart & Run All
).
Once ready, please submit your assignment as an .ipynb file (File > Download as > Notebook
). You must name your files in the following format: FIN5615_Project_1_Richard_Lee_tuc12345.ipynb
.
Note: Import all libraries that you plan on using in the code block below.
In [ ]:
import pandas as pd import numpy as np import matplotlib.pyplot as plt import random
Task 1
Continue with the example of Ford (F) stock price from the end of Lecture 3. Assume that daily price movements of F follow a simple random walk, and that the price of F today is $5.
Set the random seed to 5615 at the beginning of your code.
Your simulation should be a list of length 1000 (i.e. 1000 trials), with each element being a list of length 251 (i.e. price at time 0 plus 250 future time steps). Your histogram should have a bell shape and centered at approximately $5.
[15pts]
In [ ]:
###Use code below random.seed(5615) starting_value = 5. steps = 250 trials = 1000 ###
Task 2
One problem that arises when naively modeling stock price as a random walk is that simulated prices are not guarenteed to be positive. In the case of a simple random walk, we are assuming stock prices change by an arbitrary +$1 or -$1 at each time step.
Instead of assuming a price movement of +$1 or -$1, modify the random walk's possible price movement to be either +1% or -1% (equivalently, a mutiplicative factor of 1.01 or 0.99):
Xt+1={Xt×1.01Xt×0.99p=0.5p=0.5Xt+1={Xt×1.01p=0.5Xt×0.99p=0.5
Set the random seed to 5615 at the beginning of your code.
Your simulation should still have the same length as the previous task, but the histogram should now be skewed to the right.
[20pts]
In [ ]:
###Use code below random.seed(5615) starting_value = 5. steps = 250 trials = 1000 ###
Your written response here
Task 3
Another issue with our current random walk model is that the magnitude of the stock price's movement is the same regardless of the frequency of our simulation.
For example, if we simulate quarterly increments, then the stock price can exhibit only 4 up or down movements of 1% within one year, whereas if we simulate in daily increments the stock price can have 250 up or down movements of 1% within one year, resulting in a much wider distribution of ending prices. This type of behavior is unreasonable.
We can try to remedy this by adjusting the magnitude of the stock price movement by the "step size" (h) of our simulation:
Xt+1={Xt×(1+0.01h−−√)Xt×(1−0.01h−−√)p=0.5p=0.5Xt+1={Xt×(1+0.01h)p=0.5Xt×(1−0.01h)p=0.5
Under this new model specification, we can interpret 1% as the percentage movement in stock price over an annual period, and multiplying it by h−−√h scales it for the length of time for a single period of our simulated random walk, where h=1stepsh=1steps. For example, under daily increments, h=1250h=1250.
Set the random seed to 5615 at the beginning of your code.
[20pts]
In [ ]:
###Use code below random.seed(5615) starting_value = 5. steps = 250 trials = 1000 ###
Task 4
Another issue with our current random walk model is that our assumed annual magnitude of the stock price's movement is the same 1% regardless of the risk profile of the company. For example, an annual movement of 1% might seem reasonable for F, but definitely not for TSLA stock.
We can try to account for this by including the stock's annual volaility as another input parameter to our random walk simulation. Recall that the volatility is a measure of the disperson (a.k.a. standard deviation) on a stock's *continuously compounded returns*.
So, we can replace our arbitrary value of 1% with a change in the stock's return in that time step in terms of its annual volatility (σσ), applied as continuously compounded factors, uu and dd:
Xt+1={Xt×u=Xteσh√Xt×d=Xte−σh√p=0.5p=0.5Xt+1={Xt×u=Xteσhp=0.5Xt×d=Xte−σhp=0.5
Assume that the annual volatility of F's returns is 10%:
Set the random seed to 5615 at the beginning of your code.
The histogram of simulated annual returns should be bell shaped with a mean of approximately 0%.
[20pts]
In [ ]:
###Use code below random.seed(5615) starting_value = 5. sigma = .1 steps = 250 trials = 1000 ###
In [ ]:
In [ ]:
In [ ]:
Task 5
It is not very realistic to model 0% rates of return on stock prices. It is generally the investor's belief that stock prices will increase over time, although at what rate is unclear. For now, let's assume that the expected return on the stock is equal to the risk-free rate.
We can achieve this by adjusting the probabilities associated with an up or down movement in the stock price from 50% to a varying value of pp, such that on average we receive the risk free rate of return (I will skip over the math here, but this is the idea of risk-neutral pricing):
Xt+1={Xt×u=Xteσh√Xt×d=Xte−σh√p=erh−du−d1−pXt+1={Xt×u=Xteσhp=erh−du−dXt×d=Xte−σh1−p
Notice that the value of pp is now set by a formula, and depends on the values of uu and dd, which are just the multiplicative factors on the stock price that we defined previously.
Assume that the annual volatility of F's returns is 10% and a risk-free rate of 1%:
Set the random seed to 5615 at the beginning of your code.
Note that the values for uu, dd, and pp do not vary by time step. Check that they are approximately equal to 1.0063, 0.9937, and 0.5016, respectively.
[25pts]
In [ ]:
###Use code below random.seed(5615) starting_value = 5. sigma = .1 risk_free = .01 steps = 250 trials = 1000 ###
In [ ]:
In [ ]:
In [ ]:
In [ ]: