Final finetunings of rpc_fill messages
This commit is contained in:
parent
efbe0843be
commit
f821ef5aec
@ -242,7 +242,7 @@ class Telegram(RPCHandler):
|
|||||||
"Cancelling open {message_side} Order for {pair} (#{trade_id}). "
|
"Cancelling open {message_side} Order for {pair} (#{trade_id}). "
|
||||||
"Reason: {reason}.".format(**msg))
|
"Reason: {reason}.".format(**msg))
|
||||||
|
|
||||||
elif msg['type'] == (RPCMessageType.BUY_FILL, RPCMessageType.SELL_FILL):
|
elif msg['type'] in (RPCMessageType.BUY_FILL, RPCMessageType.SELL_FILL):
|
||||||
msg['message_side'] = 'Buy' if msg['type'] == RPCMessageType.BUY_FILL else 'Sell'
|
msg['message_side'] = 'Buy' if msg['type'] == RPCMessageType.BUY_FILL else 'Sell'
|
||||||
|
|
||||||
message = ("\N{LARGE CIRCLE} *{exchange}:* "
|
message = ("\N{LARGE CIRCLE} *{exchange}:* "
|
||||||
|
@ -314,7 +314,8 @@ def get_default_conf(testdatadir):
|
|||||||
"telegram": {
|
"telegram": {
|
||||||
"enabled": True,
|
"enabled": True,
|
||||||
"token": "token",
|
"token": "token",
|
||||||
"chat_id": "0"
|
"chat_id": "0",
|
||||||
|
"notification_settings": {},
|
||||||
},
|
},
|
||||||
"datadir": str(testdatadir),
|
"datadir": str(testdatadir),
|
||||||
"initial_state": "running",
|
"initial_state": "running",
|
||||||
|
@ -1254,6 +1254,25 @@ def test_send_msg_buy_cancel_notification(default_conf, mocker) -> None:
|
|||||||
'Reason: cancelled due to timeout.')
|
'Reason: cancelled due to timeout.')
|
||||||
|
|
||||||
|
|
||||||
|
def test_send_msg_buy_fill_notification(default_conf, mocker) -> None:
|
||||||
|
|
||||||
|
default_conf['telegram']['notification_settings']['buy_fill'] = 'on'
|
||||||
|
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||||
|
|
||||||
|
telegram.send_msg({
|
||||||
|
'type': RPCMessageType.BUY_FILL,
|
||||||
|
'trade_id': 1,
|
||||||
|
'exchange': 'Binance',
|
||||||
|
'pair': 'ETH/USDT',
|
||||||
|
'open_rate': 200,
|
||||||
|
'stake_amount': 100,
|
||||||
|
'amount': 0.5,
|
||||||
|
'open_date': arrow.utcnow().datetime
|
||||||
|
})
|
||||||
|
assert (msg_mock.call_args[0][0] == '\N{LARGE CIRCLE} *Binance:* '
|
||||||
|
'Buy order for ETH/USDT (#1) filled for 200.')
|
||||||
|
|
||||||
|
|
||||||
def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
||||||
|
|
||||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||||
|
Loading…
Reference in New Issue
Block a user