Lesson 7 of 15

Drawdown & Maximum Drawdown

Drawdown & Maximum Drawdown

A drawdown measures the decline from a historical peak to a current value. It answers: "how far have we fallen from the highest point seen so far?"

For each price PiP_i, the drawdown is: DDi=PiPeakiPeakiDD_i = \frac{P_i - \text{Peak}_i}{\text{Peak}_i}

where Peaki=max(P0,P1,...,Pi)\text{Peak}_i = \max(P_0, P_1, ..., P_i) is the running maximum.

Drawdowns are always 0\leq 0: zero when at a new high, negative otherwise.

Maximum Drawdown (MDD) is the worst (most negative) drawdown over the entire period: MDD=miniDDiMDD = \min_i DD_i

MDD is a critical risk metric used to evaluate investment strategies. A strategy with a 50% MDD means an investor could have lost half their capital at the worst point.

Your Task

Implement:

  • drawdown(prices) — list of drawdowns from running peak
  • max_drawdown(prices) — minimum drawdown value (most negative)
Python runtime loading...
Loading...
Click "Run" to execute your code.