Use correct fields in telegram

This commit is contained in:
Matthias 2020-11-03 08:34:12 +01:00
parent d1dab23283
commit b58d6d38b5
2 changed files with 9 additions and 9 deletions

View File

@ -247,14 +247,13 @@ class Telegram(RPC):
"*Open Rate:* `{open_rate:.8f}`", "*Open Rate:* `{open_rate:.8f}`",
"*Close Rate:* `{close_rate}`" if r['close_rate'] else "", "*Close Rate:* `{close_rate}`" if r['close_rate'] else "",
"*Current Rate:* `{current_rate:.8f}`", "*Current Rate:* `{current_rate:.8f}`",
("*Close Profit:* `{close_profit_pct}`" ("*Current Profit:* " if r['is_open'] else "*Close Profit: *")
if r['close_profit_pct'] is not None else ""), + "`{profit_pct:.2f}%`",
"*Current Profit:* `{current_profit_pct:.2f}%`",
] ]
if (r['stop_loss_abs'] != r['initial_stop_loss_abs'] if (r['stop_loss_abs'] != r['initial_stop_loss_abs']
and r['initial_stop_loss_pct'] is not None): and r['initial_stop_loss_pct'] is not None):
# Adding initial stoploss only if it is different from stoploss # Adding initial stoploss only if it is different from stoploss
lines.append("*Initial Stoploss:* `{initial_stop_loss:.8f}` " lines.append("*Initial Stoploss:* `{initial_stop_loss_abs:.8f}` "
"`({initial_stop_loss_pct:.2f}%)`") "`({initial_stop_loss_pct:.2f}%)`")
# Adding stoploss and stoploss percentage only if it is not None # Adding stoploss and stoploss percentage only if it is not None

View File

@ -163,16 +163,17 @@ def test_telegram_status(default_conf, update, mocker) -> None:
'amount': 90.99181074, 'amount': 90.99181074,
'stake_amount': 90.99181074, 'stake_amount': 90.99181074,
'close_profit_pct': None, 'close_profit_pct': None,
'current_profit': -0.0059, 'profit': -0.0059,
'current_profit_pct': -0.59, 'profit_pct': -0.59,
'initial_stop_loss': 1.098e-05, 'initial_stop_loss_abs': 1.098e-05,
'stop_loss': 1.099e-05, 'stop_loss_abs': 1.099e-05,
'sell_order_status': None, 'sell_order_status': None,
'initial_stop_loss_pct': -0.05, 'initial_stop_loss_pct': -0.05,
'stoploss_current_dist': 1e-08, 'stoploss_current_dist': 1e-08,
'stoploss_current_dist_pct': -0.02, 'stoploss_current_dist_pct': -0.02,
'stop_loss_pct': -0.01, 'stop_loss_pct': -0.01,
'open_order': '(limit buy rem=0.00000000)' 'open_order': '(limit buy rem=0.00000000)',
'is_open': True
}]), }]),
_status_table=status_table, _status_table=status_table,
_send_msg=msg_mock _send_msg=msg_mock