Aan de slagGa gratis aan de slag

Maximum draw-down portfolio

In this exercise, you'll learn how to calculate the maximum draw-down of the S&P500 (also known as "peak to trough performance drop"). Maximum draw-down is an incredibly insightful risk measure. It tells you what has been the worst performance of the S&P500 in the past years.

It is the reason why many investors shy away from crypto-currencies; nobody likes to lose a large percentage of their investment (e.g., 70%) in a short period.

In order to calculate the maximum draw-down of the S&P500, the daily S&P500 prices have been made available to you in a DataFrame called df.

Deze oefening maakt deel uit van de cursus

Introduction to Portfolio Analysis in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Calculate the max value 
roll_max = ____.____(center=False,min_periods=1,window=____).____()

# Calculate the daily draw-down relative to the max
daily_draw_down = ____/____ - 1
Code bewerken en uitvoeren