qis.plot_top_drawdowns_paths

qis.plot_top_drawdowns_paths(price, freq='D', max_num=10, date_format='%d%b%Y', title=None, var_format='{:.0%}', legend_loc='lower left', highlight_ongoing=False, x_limits=(0.0, None), y_limits=(None, 0.0), ax=None, **kwargs)[source]

overlay the deepest drawdown episodes, each re-indexed to the number of grid steps since its start.

The episodes come from compute_drawdowns_stats_table on the same freq grid as the plotted paths. Each path is price / peak - 1 from the episode’s start to its end, plotted against the number of freq observations since the start: calendar days on the default ‘D’ grid, native observations with freq=None. The legend’s days_dd is the episode table’s duration: calendar days for any non-None freq, observations for None.

Parameters:
  • price (Series) – level series of one asset

  • freq (str | None) – grid to rebase the levels to before finding episodes; None keeps the native grid

  • max_num (int) – number of deepest episodes to draw

  • date_format (str) – format of the start and end dates in the legend

  • highlight_ongoing (bool) – draw the episode that is still under water at the last date (is_recovered=False) solid black and the others dotted

  • title (str | None)

  • var_format (str)

  • legend_loc (str)

  • x_limits (Tuple[float | None, float | None])

  • y_limits (Tuple[float | None, float | None])

  • ax (Axes)

Returns:

the figure

Return type:

Figure