Created
January 21, 2017 19:47
-
-
Save rgkimball/4b0b3175d70d58cf13869596f6158ee1 to your computer and use it in GitHub Desktop.
Future Value of a stream of cash flows and an initial investment
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
# In 000's | |
pv = 400 | |
savings_rate = 0.10 | |
ir = 0.025 | |
periodicity = 4 | |
years = 20 | |
cf = pv * savings_rate | |
nper = periodicity * years | |
irper = ir / periodicity | |
cfper = cf / periodicity | |
terminal_value = pv * (1 + irper) ** nper | |
sum_of_cfs = 0 | |
for n in range(nper): | |
this_cf = cfper * ((1 + irper) ** n) | |
print("CF in period %d = %0.2f" % (n, this_cf)) | |
sum_of_cfs += this_cf | |
fv = terminal_value + sum_of_cfs | |
print("FV of savings = ${:,.2f}".format(fv)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment