qis.compute_rolling_drawdown_time_under_water¶
- qis.compute_rolling_drawdown_time_under_water(prices, sampling_freq='D')[source]¶
Compute joint drawdown and time-under-water series.
The levels are first rebased to
sampling_freqwith forward filling. Time under water then counts the consecutive grid points, up to and including each date, at which the level is below its running peak, resetting to zero at every new high. On ‘D’ it is the number of calendar days since the last day at the running peak: a Friday peak followed by a Monday fall counts from Sunday, the last forward-filled day at the peak.- Parameters:
- Returns:
Tuple of (drawdown, time_under_water) of the input type (Series or DataFrame) and columns, both on the rebased
sampling_freqgrid, not the input index: a business-day input returns more rows on ‘D’. Leading missing levels count as zero time under water.- Raises:
ValueError – If
pricesis neither Series nor DataFrame.- Return type: