This commit is contained in:
Kavinkumar 2022-02-24 21:50:17 +05:30
parent 8e5c880c11
commit 24f8fb4ece

View File

@ -240,7 +240,9 @@ class RPC:
trade_profit = trade.calc_profit2(open_rate, current_rate, amount) trade_profit = trade.calc_profit2(open_rate, current_rate, amount)
profit_pct = ( open_cost + trade_profit)/open_cost - 1 profit_pct = ( open_cost + trade_profit)/open_cost - 1
profit_str = f'{profit_pct:.2%}' profit_str = f'{profit_pct:.2%}'
open_date = b_order.order_date
else: else:
open_date = trade.open_date
trade_profit = trade.calc_profit(current_rate) trade_profit = trade.calc_profit(current_rate)
profit_str = f'{trade.calc_profit_ratio(current_rate):.2%}' profit_str = f'{trade.calc_profit_ratio(current_rate):.2%}'
if self._fiat_converter: if self._fiat_converter:
@ -254,14 +256,14 @@ class RPC:
fiat_profit_sum = fiat_profit if isnan(fiat_profit_sum) \ fiat_profit_sum = fiat_profit if isnan(fiat_profit_sum) \
else fiat_profit_sum + fiat_profit else fiat_profit_sum + fiat_profit
last_sell_order = trade.select_order('sell') last_sell_order = trade.select_order('sell')
last_sell_order_id = last_sell_order.order_id if last_sell_order else None last_sell_order_id = last_sell_order.order_id if last_sell_order else -1
detail_trade = [ detail_trade = [
trade.id, trade.id,
trade.pair + ('*' if (trade.open_order_id == trade.pair + ('*' if (trade.open_order_id ==
trade.select_order('buy').order_id) else '') trade.select_order('buy').order_id) else '')
+ ('**' if (trade.open_order_id == + ('**' if (trade.open_order_id ==
last_sell_order_id) else ''), last_sell_order_id) else ''),
shorten_date(arrow.get(trade.open_date).humanize(only_distance=True)), shorten_date(arrow.get(open_date).humanize(only_distance=True)),
profit_str profit_str
] ]
if self._config.get('position_adjustment_enable', False): if self._config.get('position_adjustment_enable', False):
@ -276,7 +278,7 @@ class RPC:
profitcol += " (" + fiat_display_currency + ")" profitcol += " (" + fiat_display_currency + ")"
if self._config.get('position_adjustment_enable', False): if self._config.get('position_adjustment_enable', False):
columns = ['ID', 'Pair', 'Since', profitcol, '# Entries'] columns = ['ID', 'Pair', 'Since', profitcol, '# Entr'+['ies', 'y'][show_order]]
else: else:
columns = ['ID', 'Pair', 'Since', profitcol] columns = ['ID', 'Pair', 'Since', profitcol]
return trades_list, columns, fiat_profit_sum return trades_list, columns, fiat_profit_sum