LoslegenKostenlos loslegen

Portfolio cumulative returns

In the previous exercise, you've calculated the mean performance over a period of time. This gives you one performance number for that entire period. But what if you would want to plot the development of the performance over time? For that, you will need the cumulative performance, not the mean performance. Just like with interest in your bank account, the cumulative performance gives you the compounded return at each date in your dataset. It tells you; "up until today, this is what the total return has been since the start of my data."

Remember because of the compounding effect, you need to use cumprod() for this calculation. NumPy has already been imported as np and available are the daily returns data from the previous exercise under returns. Let's give it a try!

Diese Übung ist Teil des Kurses

Introduction to Portfolio Analysis in Python

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Create portfolio returns column
returns['Portfolio']= ____.____(____)
Code bearbeiten und ausführen