Improve NAN Handling in RPC

This commit is contained in:
Matthias 2022-08-11 20:16:07 +02:00
parent de690b0a69
commit cc885e25ac

View File

@ -179,8 +179,10 @@ class RPC:
else: else:
current_rate = trade.close_rate current_rate = trade.close_rate
if len(trade.select_filled_orders(trade.entry_side)) > 0: if len(trade.select_filled_orders(trade.entry_side)) > 0:
current_profit = trade.calc_profit_ratio(current_rate) current_profit = trade.calc_profit_ratio(
current_profit_abs = trade.calc_profit(current_rate) current_rate) if not isnan(current_rate) else NAN
current_profit_abs = trade.calc_profit(
current_rate) if not isnan(current_rate) else NAN
current_profit_fiat: Optional[float] = None current_profit_fiat: Optional[float] = None
# Calculate fiat profit # Calculate fiat profit
if self._fiat_converter: if self._fiat_converter: