Skip to main content

NotesGetting the numbers right

The start is a peak

A drawdown is measured from the highest wealth so far, and the starting wealth is the first high.

What I was looking for

Drawdown bugs in quant libraries, checked against hand-computed values on short series.

What I found

Code that builds the running peak only from observed values skips the start, so a loss on the first bar never counts as a drawdown. The series looks safest exactly when it starts badly.

On a long history a later, deeper drawdown hides the error. On short windows it decides things: cross-validation folds, walk-forward periods, the first days of a live record. I found it in five libraries in one scan; in skfolio a −10% then +5% series reported a max drawdown of 0 instead of 0.10, and its own optimizer disagreed with its own measure. The fix shipped in v1.4.1.

The move

On any metric with a running state, I test the first bar on purpose: a loss on day one is the case that breaks it.