ComeçarComece de graça

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!

Este exercício faz parte do curso

Introduction to Portfolio Analysis in Python

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Create portfolio returns column
returns['Portfolio']= ____.____(____)
Editar e executar o código