Add test for max_drawdown calculation

This commit is contained in:
Matthias
2020-03-03 07:20:41 +01:00
parent 3479f7d986
commit e050511ddc
2 changed files with 19 additions and 3 deletions

View File

@@ -198,7 +198,7 @@ def calculate_max_drawdown(trades: pd.DataFrame) -> Tuple[float, pd.Timestamp, p
:raise: ValueError if trade-dataframe was found empty.
"""
if len(trades) == 0:
raise ValueError("Trade dataframe empty")
raise ValueError("Trade dataframe empty.")
profit_results = trades.sort_values('close_time')
max_drawdown_df = pd.DataFrame()
max_drawdown_df['cumulative'] = profit_results['profitperc'].cumsum()