Last active
November 13, 2020 04:06
-
-
Save zachlim98/db02f020cd9902636225d3d1f9c9d026 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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