simplify status command

This commit is contained in:
gcarq 2017-11-05 18:35:32 +01:00
parent 0f1d114c03
commit d12dba16db

View File

@ -185,20 +185,14 @@ def _status_table(bot: Bot, update: Update) -> None:
for trade in trades: for trade in trades:
# calculate profit and send message to user # calculate profit and send message to user
current_rate = exchange.get_ticker(trade.pair)['bid'] current_rate = exchange.get_ticker(trade.pair)['bid']
current_profit = '{:.2f}'.format(100 * ((current_rate \ trades_list.append([
- trade.open_rate) / trade.open_rate))
row = [
trade.id, trade.id,
trade.pair, trade.pair,
shorten_date(arrow.get(trade.open_date).humanize(only_distance=True)), shorten_date(arrow.get(trade.open_date).humanize(only_distance=True)),
current_profit '{:.2f}'.format(100 * trade.calc_profit(current_rate))
] ])
trades_list.append(row)
columns = ['ID', 'Pair', 'Since', 'Profit'] columns = ['ID', 'Pair', 'Since', 'Profit']
df_statuses = DataFrame.from_records(trades_list, columns=columns) df_statuses = DataFrame.from_records(trades_list, columns=columns)
df_statuses = df_statuses.set_index(columns[0]) df_statuses = df_statuses.set_index(columns[0])