sigmaquant.performance.risk.drawdown#

sigmaquant.performance.risk.drawdown(returns, kind='simple', starting_value=0.0)#

Compute the drawdown series.

The drawdown is computed from the equity curve implied by the input returns or PnL.

Parameters:
  • returns – Input time series:

  • kind ({"simple", "pnl", "log"}, optional) –

    Type of input values.

    • "simple": simple (decimal) returns, compounded multiplicatively

    • "log": log-returns, aggregated additively

    • "pnl": additive profit-and-loss values

  • starting_value – Initial cumulative level. For PnL inputs, this represents the initial capital.

Returns:

Drawdown series:
  • relative drawdown for simple and log returns

  • relative drawdown for pnl if starting_value > 0

  • absolute drawdown for pnl if starting_value == 0

Return type:

pandas.Series or numpy.ndarray

Notes

Let \(W_t\) denote the equity curve implied by the input series.

The relative drawdown is defined as:

\[\mathrm{DD}_t = \frac{W_t} {\max_{s \le t} W_s} - 1\]

For kind="simple" and kind="log", \(W_t\) is the cumulative equity obtained from returns.

For kind="pnl":
  • if starting_value > 0, the relative drawdown is computed;

  • if starting_value = 0, the absolute drawdown is returned:

\[\mathrm{DD}_t^{abs} = W_t - \max_{s \le t} W_s\]