按收入百分比进行投资(I)
很遗憾,您确实无法每月储蓄 $3,000,并在仅 15 年后就积累到 $1,000,000。
但您可以从小做起,每月把税后收入的一小部分拿来投资。随着收入增长,这部分金额也会逐步增加。
在本练习中,您将为长期模拟这一投资过程打下基础。
salary_forecast 和 expenses_forecast 变量可从上一个练习中获得。
cash_flow_forecast 也已提供,它是一个数组,表示您预测的薪资减去预测的支出。变量 monthly_investment_percentage 已设为 0.30。
本练习是课程的一部分
Python 金融概念入门
练习说明
- 使用投资百分比计算
investment_deposit_forecast,即基于预测现金流的各期每月投资存入额。 - 计算各期每月的储蓄存入额(这是未用于投资、结余的部分)。
- 计算随时间累计的储蓄。
- 运行提供的代码,绘制预测的每月储蓄与投资的对比图。
交互式实操练习
通过完成这段示例代码来试试这个练习。
import numpy as np
# Calculate your monthly deposit into your investment account
investment_deposit_forecast = ____
# The rest goes into your savings account
savings_forecast_new = ____ * ____
# Calculate your cumulative savings over time
cumulative_savings_new = ____
# Plot your forecasted monthly savings vs investments
plt.plot(investment_deposit_forecast, color='red')
plt.plot(savings_forecast_new, color='blue')
plt.legend(handles=[investments_plot, savings_plot], loc=2)
plt.show()