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.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Introduction to Portfolio Analysis in Python
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# 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