Skip to content

Commit

Permalink
Merge pull request ranaroussi#165 from msh855/msh855Branch
Browse files Browse the repository at this point in the history
fixed a bug when reporting the max drawdown
  • Loading branch information
ranaroussi authored Feb 14, 2022
2 parents 761b4b2 + c3b1505 commit 29fe228
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions quantstats/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,10 @@ def full(returns, benchmark=None, rf=0., grayscale=False,
returns, benchmark = _match_dates(returns, benchmark)

dd = _stats.to_drawdown_series(returns)
dd_info = _stats.drawdown_details(dd).sort_values(
by='max drawdown', ascending=True)[:5]

col = _stats.drawdown_details(dd).columns[4]
dd_info = _stats.drawdown_details(dd).sort_values(by = col,
ascending = True)[:5]

if not dd_info.empty:
dd_info.index = range(1, min(6, len(dd_info)+1))
dd_info.columns = map(lambda x: str(x).title(), dd_info.columns)
Expand Down

0 comments on commit 29fe228

Please sign in to comment.