diff --git a/freqtrade/persistence/models.py b/freqtrade/persistence/models.py index bbbc55c13..b4c299120 100644 --- a/freqtrade/persistence/models.py +++ b/freqtrade/persistence/models.py @@ -841,7 +841,7 @@ class Trade(_DECL_BASE, LocalTrade): ] @staticmethod - def get_best_pair(): + def get_best_pair(start_date: datetime = datetime.fromtimestamp(0)): """ Get best pair with closed trade. NOTE: Not supported in Backtesting. @@ -849,7 +849,7 @@ class Trade(_DECL_BASE, LocalTrade): """ best_pair = Trade.query.with_entities( Trade.pair, func.sum(Trade.close_profit).label('profit_sum') - ).filter(Trade.is_open.is_(False)) \ + ).filter(Trade.is_open.is_(False) & (Trade.close_date >= start_date)) \ .group_by(Trade.pair) \ .order_by(desc('profit_sum')).first() return best_pair diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py index 1b94bc11f..538e95f40 100644 --- a/freqtrade/rpc/rpc.py +++ b/freqtrade/rpc/rpc.py @@ -381,7 +381,7 @@ class RPC: ) profit_all_ratio.append(profit_ratio) - best_pair = Trade.get_best_pair() + best_pair = Trade.get_best_pair(start_date) # Prepare data to display profit_closed_coin_sum = round(sum(profit_closed_coin), 8)