想成为百万富翁吗?
您的预测显示,只要严格执行预算并让工资稳步增长,15 年内您就能累计超过 $700,000。
但您希望在 15 年内成为百万富翁,早点退休,余生品着玛格丽塔、到处旅行。要做到这一点,您需要进行投资。
还记得 numpy 中的 .pmt() 函数吗?您可以用它来计算每月需要储蓄多少,才能在一段时间内积累到目标财富。
您对股市还有很多要学的,但您的理财顾问告诉您,若投资于低成本指数基金,平均每年有望获得 5%–10% 的收益。
您知道股市并非总是上涨,但这里将假设年回报率为 7%(这是 1950–2009 年美国股市的平均年回报)。
上一练习中的变量 forecast_months 可用。
本练习是课程的一部分
Python 金融概念入门
练习说明
- 将
investment_rate_annual设为 7%,并推导月度投资利率。 - 计算在 15 年内累计到 $1,000,000 所需的每月投资额。
交互式实操练习
通过完成这段示例代码来试试这个练习。
import numpy as np
# Set the annual investment return to 7%
investment_rate_annual = ____
# Calculate the monthly investment return
investment_rate_monthly = ____
# Calculate your required monthly investment to amass $1M
required_investment_monthly = ____(rate=____, nper=____, pv=____, fv=____)
print("You will have to invest $" + str(round(required_investment_monthly, 2)) + " per month to amass $1M over 15 years")