Skip to content

Instantly share code, notes, and snippets.

@zachlim98
Last active November 13, 2020 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachlim98/db02f020cd9902636225d3d1f9c9d026 to your computer and use it in GitHub Desktop.
Save zachlim98/db02f020cd9902636225d3d1f9c9d026 to your computer and use it in GitHub Desktop.
import random
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
import seaborn as sns
import math
def EstimateReturns(initial_invest, expected_returns, std_dev, duration):
final_money = []
yearcount = []
year = 1
for year in range(duration):
this_return = np.random.normal(expected_returns,std_dev)
initial_invest = initial_invest * (1+this_return)
final_money.append(initial_invest)
yearcount.append(year)
plt.ylabel('Amount of $')
plt.xlabel('Number of years')
plt.plot(yearcount,final_money)
final_funds.append(final_money[-1])
return(final_funds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment