Get startedGet started for free

Investing a percentage of your income (I)

Unfortunately, you really can't afford to save $3,000 per month in order to amass $1,000,000 after only 15 years.

But what you can do is start slowly, investing a small percentage of your take-home income each month, which should grow over time as your income grows as well.

In this exercise, you will lay the foundations to simulate this investing process over time.

The salary_forecast and expenses_forecast variables are available from the previous exercise.

The cash_flow_forecast is also available, and is an array of your forecasted salary minus your forecasted expenses. The monthly_investment_percentage variable is already set to 0.30.

This exercise is part of the course

Introduction to Financial Concepts in Python

View Course

Exercise instructions

  • Using the investment percentage, calculate investment_deposit_forecast, your monthly investment deposits for each period based on your forecasted cash flows.
  • Calculate your monthly savings deposits for each period (this is the money left over that you didn't invest).
  • Calculate your cumulative savings over time.
  • Run the code provided to plot forecasted monthly savings vs investments.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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()
Edit and Run Code