Merge remote-tracking branch 'origin/additionalColumnForStatusTable' into wohlgemuth

This commit is contained in:
Gert Wohlgemuth 2018-05-11 15:35:44 -07:00
commit 4b31b79d37
2 changed files with 7 additions and 2 deletions

View File

@ -63,6 +63,7 @@ class RPC(object):
"*Close Rate:* `{close_rate}`\n" \ "*Close Rate:* `{close_rate}`\n" \
"*Current Rate:* `{current_rate:.8f}`\n" \ "*Current Rate:* `{current_rate:.8f}`\n" \
"*Close Profit:* `{close_profit}`\n" \ "*Close Profit:* `{close_profit}`\n" \
"*Stake Value:* `{stake_value}`\n" \
"*Current Profit:* `{current_profit:.2f}%`\n" \ "*Current Profit:* `{current_profit:.2f}%`\n" \
"*Open Order:* `{open_order}`"\ "*Open Order:* `{open_order}`"\
.format( .format(
@ -75,6 +76,7 @@ class RPC(object):
current_rate=current_rate, current_rate=current_rate,
amount=round(trade.amount, 8), amount=round(trade.amount, 8),
close_profit=fmt_close_profit, close_profit=fmt_close_profit,
stake_value=round(current_rate * trade.amount, 8),
current_profit=round(current_profit * 100, 2), current_profit=round(current_profit * 100, 2),
open_order='({} {} rem={:.8f})'.format( open_order='({} {} rem={:.8f})'.format(
order['type'], order['side'], order['remaining'] order['type'], order['side'], order['remaining']
@ -98,10 +100,11 @@ class RPC(object):
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)),
'{:.2f}%'.format(100 * trade.calc_profit_percent(current_rate)) '{:.2f}%'.format(100 * trade.calc_profit_percent(current_rate)),
'{:.8f}'.format(trade.amount * current_rate)
]) ])
columns = ['ID', 'Pair', 'Since', 'Profit'] columns = ['ID', 'Pair', 'Since', 'Profit', 'Value']
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])
# The style used throughout is to return a tuple # The style used throughout is to return a tuple

View File

@ -67,6 +67,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'*Close Rate:* `None`\n' '*Close Rate:* `None`\n'
'*Current Rate:* `0.00001098`\n' '*Current Rate:* `0.00001098`\n'
'*Close Profit:* `None`\n' '*Close Profit:* `None`\n'
'*Stake Value:* `0.00099909`\n'
'*Current Profit:* `-0.59%`\n' '*Current Profit:* `-0.59%`\n'
'*Open Order:* `(limit buy rem=0.00000000)`' '*Open Order:* `(limit buy rem=0.00000000)`'
] ]
@ -106,6 +107,7 @@ def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None:
assert 'just now' in result['Since'].all() assert 'just now' in result['Since'].all()
assert 'ETH/BTC' in result['Pair'].all() assert 'ETH/BTC' in result['Pair'].all()
assert '-0.59%' in result['Profit'].all() assert '-0.59%' in result['Profit'].all()
assert 'Value' in result
def test_rpc_daily_profit(default_conf, update, ticker, fee, def test_rpc_daily_profit(default_conf, update, ticker, fee,