From 38243c52fd2133f83299efc7bf94c2703b978209 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 13 Nov 2019 20:45:16 +0100 Subject: [PATCH] Filter open trades - they are not added to the profit calc --- freqtrade/plot/plotting.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index 6f78802ba..57a02dd6b 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -379,7 +379,12 @@ def plot_profit(config: Dict[str, Any]) -> None: plot_elements = init_plotscript(config) trades = plot_elements['trades'] # Filter trades to relevant pairs - trades = trades[trades['pair'].isin(plot_elements["pairs"])] + # Remove open pairs - we don't know the profit yet so can't calculate profit for these. + # Also, If only one open pair is left, then the profit-generation would fail. + trades = trades[(trades['pair'].isin(plot_elements["pairs"])) + & (~trades['close_time'].isnull()) + ] + # Create an average close price of all the pairs that were involved. # this could be useful to gauge the overall market trend fig = generate_profit_graph(plot_elements["pairs"], plot_elements["tickers"],