stats.py drawdown_details len(starts)>len(ends)
hi team,
I tracked it down:
File "D:\prop\myscript.py", line 33, in
I suspect there's a bug in drawdown_details
def drawdown_details(drawdown):
...
for i, _ in enumerate(starts):
dd = drawdown[starts[i] : ends[i]]
clean_dd = -remove_outliers(-dd, 0.99)
data.append(
(
starts[i],
dd.idxmin(),
ends[i],
(ends[i] - starts[i]).days + 1,
dd.min() * 100,
clean_dd.min() * 100,
)
)
It below up when i = 17, this is when I found out len(starts) > len(ends) len(list(starts)): 19 len(list(ends)): 17
The temporary local fix I have for this is: min_len = min(len(list(starts)), len(list(ends))) for i in range(min_len): dd = drawdown[starts[i] : ends[i]]
Thanks