Show Number of exits

part of #8234
This commit is contained in:
Matthias 2023-03-02 19:50:01 +01:00
parent 6a0848a3a9
commit 022f85095e
2 changed files with 4 additions and 0 deletions

View File

@ -561,6 +561,8 @@ class Telegram(RPCHandler):
for r in results: for r in results:
r['open_date_hum'] = arrow.get(r['open_date']).humanize() r['open_date_hum'] = arrow.get(r['open_date']).humanize()
r['num_entries'] = len([o for o in r['orders'] if o['ft_is_entry']]) r['num_entries'] = len([o for o in r['orders'] if o['ft_is_entry']])
r['num_exits'] = len([o for o in r['orders'] if not o['ft_is_entry']
and not o['ft_order_side'] == 'stoploss'])
r['exit_reason'] = r.get('exit_reason', "") r['exit_reason'] = r.get('exit_reason', "")
r['stake_amount_r'] = round_coin_value(r['stake_amount'], r['quote_currency']) r['stake_amount_r'] = round_coin_value(r['stake_amount'], r['quote_currency'])
r['profit_abs_r'] = round_coin_value(r['profit_abs'], r['quote_currency']) r['profit_abs_r'] = round_coin_value(r['profit_abs'], r['quote_currency'])
@ -581,6 +583,7 @@ class Telegram(RPCHandler):
if position_adjust: if position_adjust:
max_buy_str = (f"/{max_entries + 1}" if (max_entries > 0) else "") max_buy_str = (f"/{max_entries + 1}" if (max_entries > 0) else "")
lines.append("*Number of Entries:* `{num_entries}`" + max_buy_str) lines.append("*Number of Entries:* `{num_entries}`" + max_buy_str)
lines.append("*Number of Exits:* `{num_exits}`")
lines.extend([ lines.extend([
"*Open Rate:* `{open_rate:.8f}`", "*Open Rate:* `{open_rate:.8f}`",

View File

@ -279,6 +279,7 @@ def test_telegram_status_multi_entry(default_conf, update, mocker, fee) -> None:
assert msg_mock.call_count == 4 assert msg_mock.call_count == 4
msg = msg_mock.call_args_list[0][0][0] msg = msg_mock.call_args_list[0][0][0]
assert re.search(r'Number of Entries.*2', msg) assert re.search(r'Number of Entries.*2', msg)
assert re.search(r'Number of Exits.*0', msg)
assert re.search(r'Average Entry Price', msg) assert re.search(r'Average Entry Price', msg)
assert re.search(r'Order filled', msg) assert re.search(r'Order filled', msg)
assert re.search(r'Close Date:', msg) is None assert re.search(r'Close Date:', msg) is None