From d12dba16db914dd97b316fc5fa816dbd9a768b78 Mon Sep 17 00:00:00 2001 From: gcarq Date: Sun, 5 Nov 2017 18:35:32 +0100 Subject: [PATCH] simplify status command --- freqtrade/rpc/telegram.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index ca565d16d..d2f23a86b 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -185,20 +185,14 @@ def _status_table(bot: Bot, update: Update) -> None: for trade in trades: # calculate profit and send message to user current_rate = exchange.get_ticker(trade.pair)['bid'] - current_profit = '{:.2f}'.format(100 * ((current_rate \ - - trade.open_rate) / trade.open_rate)) - - row = [ + trades_list.append([ trade.id, trade.pair, shorten_date(arrow.get(trade.open_date).humanize(only_distance=True)), - current_profit - ] - - trades_list.append(row) + '{:.2f}'.format(100 * trade.calc_profit(current_rate)) + ]) columns = ['ID', 'Pair', 'Since', 'Profit'] - df_statuses = DataFrame.from_records(trades_list, columns=columns) df_statuses = df_statuses.set_index(columns[0])