Add test and formatting to drawdown

This commit is contained in:
Matthias
2020-03-03 20:18:38 +01:00
parent 33a63562cb
commit 9d8970a76b
4 changed files with 10 additions and 5 deletions

View File

@@ -190,7 +190,7 @@ def create_cum_profit(df: pd.DataFrame, trades: pd.DataFrame, col_name: str,
return df
def calculate_max_drawdown(trades: pd.DataFrame, date_col: str = 'close_time',
def calculate_max_drawdown(trades: pd.DataFrame, *, date_col: str = 'close_time',
value_col: str = 'profitperc'
) -> Tuple[float, pd.Timestamp, pd.Timestamp]:
"""

View File

@@ -126,8 +126,8 @@ def add_max_drawdown(fig, row, trades: pd.DataFrame, df_comb: pd.DataFrame) -> m
df_comb.loc[lowdate, 'cum_profit'],
],
mode='markers',
name='Max Drawdown',
text=f"Max drawdown {max_drawdown}",
name=f"Max drawdown {max_drawdown:.2f}%",
text=f"Max drawdown {max_drawdown:.2f}%",
marker=dict(
symbol='square-open',
size=9,