Fix some Type issues

This commit is contained in:
Matthias 2023-02-20 07:12:09 +01:00
parent f6b3998bbd
commit 8765e3a4d6

View File

@ -189,8 +189,8 @@ class RPC:
else: else:
# Closed trade ... # Closed trade ...
current_rate = trade.close_rate current_rate = trade.close_rate
current_profit = trade.close_profit current_profit = trade.close_profit or 0.0
current_profit_abs = trade.close_profit_abs current_profit_abs = trade.close_profit_abs or 0.0
total_profit_abs = trade.realized_profit + current_profit_abs total_profit_abs = trade.realized_profit + current_profit_abs
# Calculate fiat profit # Calculate fiat profit
@ -449,11 +449,11 @@ class RPC:
durations.append((trade.close_date - trade.open_date).total_seconds()) durations.append((trade.close_date - trade.open_date).total_seconds())
if not trade.is_open: if not trade.is_open:
profit_ratio = trade.close_profit profit_ratio = trade.close_profit or 0.0
profit_abs = trade.close_profit_abs profit_abs = trade.close_profit_abs or 0.0
profit_closed_coin.append(profit_abs) profit_closed_coin.append(profit_abs)
profit_closed_ratio.append(profit_ratio) profit_closed_ratio.append(profit_ratio)
if trade.close_profit >= 0: if profit_ratio >= 0:
winning_trades += 1 winning_trades += 1
winning_profit += profit_abs winning_profit += profit_abs
else: else: