I am looking for a way to create a list of random stock returns that have a volatility of 15% and an expected return of 5% - both annualized.
I am currently at this point:
init_investment = 100
print('Enter the number of runs')
NoOfRuns = input()
T = int(NoOfRuns)
mu = 0.05 / 260
sigma = 0.15 * np.sqrt(1/260)
dt = 1
N = round(T/dt)
t = np.linspace(0, T, N)
W = np.random.standard_normal(size = N)
W = np.cumsum(W)*np.sqrt(dt) ### standard brownian motion ###
X = (mu-0.5*sigma**2)*t + sigma*W
S = init_investment * np.exp(X) ### geometric brownian motion ###
This is an adaption of the answer found here:
http://ift.tt/2b1fM7J
The problem I'm facing is two fold:
1) They are depending on each other and I want them to be independent and
2) the returns are way too volatile. <<< I've solved that.
I am very much aware of the fact that S = init_investment * np.exp(X) ### geometric brownian motion ###
is not necessary for what I'm trying to achieve. I have it in there because I wanted to know how the returns will play out.
I have the suspicion that the following line is causing a problem:
np.cumsum(W)
(I don't need cumsum if I want them to be independent?).
I would already be served if there was a way for me to create a single random return based on a volatility and an expected return. I don't necessarily need a series for that.
Edit: I seemed to have found a fix to my sigma problem.
Edit2: I think I've found a solution to my problem here:
http://ift.tt/2bd2cl3
I would still prefer to use the Brownian motion but not sure if that even makes sense?
Aucun commentaire:
Enregistrer un commentaire