No percent where ratio is to be used
This commit is contained in:
@@ -155,9 +155,9 @@ class RPC:
|
||||
current_rate = self._freqtrade.get_sell_rate(trade.pair, False)
|
||||
except DependencyException:
|
||||
current_rate = NAN
|
||||
trade_perc = (100 * trade.calc_profit_ratio(current_rate))
|
||||
trade_percent = (100 * trade.calc_profit_ratio(current_rate))
|
||||
trade_profit = trade.calc_profit(current_rate)
|
||||
profit_str = f'{trade_perc:.2f}%'
|
||||
profit_str = f'{trade_percent:.2f}%'
|
||||
if self._fiat_converter:
|
||||
fiat_profit = self._fiat_converter.convert_amount(
|
||||
trade_profit,
|
||||
@@ -232,9 +232,9 @@ class RPC:
|
||||
trades = Trade.get_trades().order_by(Trade.id).all()
|
||||
|
||||
profit_all_coin = []
|
||||
profit_all_perc = []
|
||||
profit_all_ratio = []
|
||||
profit_closed_coin = []
|
||||
profit_closed_perc = []
|
||||
profit_closed_ratio = []
|
||||
durations = []
|
||||
|
||||
for trade in trades:
|
||||
@@ -246,21 +246,21 @@ class RPC:
|
||||
durations.append((trade.close_date - trade.open_date).total_seconds())
|
||||
|
||||
if not trade.is_open:
|
||||
profit_percent = trade.calc_profit_ratio()
|
||||
profit_ratio = trade.calc_profit_ratio()
|
||||
profit_closed_coin.append(trade.calc_profit())
|
||||
profit_closed_perc.append(profit_percent)
|
||||
profit_closed_ratio.append(profit_ratio)
|
||||
else:
|
||||
# Get current rate
|
||||
try:
|
||||
current_rate = self._freqtrade.get_sell_rate(trade.pair, False)
|
||||
except DependencyException:
|
||||
current_rate = NAN
|
||||
profit_percent = trade.calc_profit_ratio(rate=current_rate)
|
||||
profit_ratio = trade.calc_profit_ratio(rate=current_rate)
|
||||
|
||||
profit_all_coin.append(
|
||||
trade.calc_profit(rate=trade.close_rate or current_rate)
|
||||
)
|
||||
profit_all_perc.append(profit_percent)
|
||||
profit_all_ratio.append(profit_ratio)
|
||||
|
||||
best_pair = Trade.get_best_pair()
|
||||
|
||||
@@ -271,7 +271,7 @@ class RPC:
|
||||
|
||||
# Prepare data to display
|
||||
profit_closed_coin_sum = round(sum(profit_closed_coin), 8)
|
||||
profit_closed_percent = (round(mean(profit_closed_perc) * 100, 2) if profit_closed_perc
|
||||
profit_closed_percent = (round(mean(profit_closed_ratio) * 100, 2) if profit_closed_ratio
|
||||
else 0.0)
|
||||
profit_closed_fiat = self._fiat_converter.convert_amount(
|
||||
profit_closed_coin_sum,
|
||||
@@ -280,7 +280,7 @@ class RPC:
|
||||
) if self._fiat_converter else 0
|
||||
|
||||
profit_all_coin_sum = round(sum(profit_all_coin), 8)
|
||||
profit_all_percent = round(mean(profit_all_perc) * 100, 2) if profit_all_perc else 0.0
|
||||
profit_all_percent = round(mean(profit_all_ratio) * 100, 2) if profit_all_ratio else 0.0
|
||||
profit_all_fiat = self._fiat_converter.convert_amount(
|
||||
profit_all_coin_sum,
|
||||
stake_currency,
|
||||
|
@@ -148,7 +148,7 @@ class Telegram(RPC):
|
||||
|
||||
elif msg['type'] == RPCMessageType.SELL_NOTIFICATION:
|
||||
msg['amount'] = round(msg['amount'], 8)
|
||||
msg['profit_percent'] = round(msg['profit_percent'] * 100, 2)
|
||||
msg['profit_percent'] = round(msg['profit_ratio'] * 100, 2)
|
||||
msg['duration'] = msg['close_date'].replace(
|
||||
microsecond=0) - msg['open_date'].replace(microsecond=0)
|
||||
msg['duration_min'] = msg['duration'].total_seconds() / 60
|
||||
|
Reference in New Issue
Block a user