Properly deprecate webhook settings (with transition)
This commit is contained in:
parent
5ecb695e50
commit
125dff1dad
@ -90,6 +90,12 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
|||||||
'notification_settings', 'exit_fill')
|
'notification_settings', 'exit_fill')
|
||||||
process_deprecated_setting(config['telegram'], 'notification_settings', 'sell_cancel',
|
process_deprecated_setting(config['telegram'], 'notification_settings', 'sell_cancel',
|
||||||
'notification_settings', 'exit_cancel')
|
'notification_settings', 'exit_cancel')
|
||||||
|
if config.get('webhook'):
|
||||||
|
process_deprecated_setting(config, 'webhook', 'webhooksell', 'webhook', 'webhookexit')
|
||||||
|
process_deprecated_setting(config, 'webhook', 'webhooksellcancel',
|
||||||
|
'webhook', 'webhookexitcancel')
|
||||||
|
process_deprecated_setting(config, 'webhook', 'webhooksellfill',
|
||||||
|
'webhook', 'webhookexitfill')
|
||||||
|
|
||||||
# Legacy way - having them in experimental ...
|
# Legacy way - having them in experimental ...
|
||||||
process_removed_setting(config, 'experimental', 'use_sell_signal',
|
process_removed_setting(config, 'experimental', 'use_sell_signal',
|
||||||
|
@ -44,7 +44,6 @@ class Webhook(RPCHandler):
|
|||||||
""" Send a message to telegram channel """
|
""" Send a message to telegram channel """
|
||||||
try:
|
try:
|
||||||
whconfig = self._config['webhook']
|
whconfig = self._config['webhook']
|
||||||
# DEPRECATED: Sell terminology
|
|
||||||
if msg['type'] in [RPCMessageType.BUY, RPCMessageType.SHORT]:
|
if msg['type'] in [RPCMessageType.BUY, RPCMessageType.SHORT]:
|
||||||
valuedict = whconfig.get('webhookbuy', None)
|
valuedict = whconfig.get('webhookbuy', None)
|
||||||
elif msg['type'] in [RPCMessageType.BUY_CANCEL, RPCMessageType.SHORT_CANCEL]:
|
elif msg['type'] in [RPCMessageType.BUY_CANCEL, RPCMessageType.SHORT_CANCEL]:
|
||||||
@ -52,12 +51,11 @@ class Webhook(RPCHandler):
|
|||||||
elif msg['type'] in [RPCMessageType.BUY_FILL, RPCMessageType.SHORT_FILL]:
|
elif msg['type'] in [RPCMessageType.BUY_FILL, RPCMessageType.SHORT_FILL]:
|
||||||
valuedict = whconfig.get('webhookbuyfill', None)
|
valuedict = whconfig.get('webhookbuyfill', None)
|
||||||
elif msg['type'] == RPCMessageType.EXIT:
|
elif msg['type'] == RPCMessageType.EXIT:
|
||||||
valuedict = whconfig.get('webhookexit', whconfig.get('webhooksell', None))
|
valuedict = whconfig.get('webhookexit', None)
|
||||||
elif msg['type'] == RPCMessageType.EXIT_FILL:
|
elif msg['type'] == RPCMessageType.EXIT_FILL:
|
||||||
valuedict = whconfig.get('webhookexitfill', whconfig.get('webhookexitfill', None))
|
valuedict = whconfig.get('webhookexitfill', None)
|
||||||
elif msg['type'] == RPCMessageType.EXIT_CANCEL:
|
elif msg['type'] == RPCMessageType.EXIT_CANCEL:
|
||||||
valuedict = whconfig.get('webhookexitcancel',
|
valuedict = whconfig.get('webhookexitcancel', None)
|
||||||
whconfig.get('webhooksellcancel', None))
|
|
||||||
elif msg['type'] in (RPCMessageType.STATUS,
|
elif msg['type'] in (RPCMessageType.STATUS,
|
||||||
RPCMessageType.STARTUP,
|
RPCMessageType.STARTUP,
|
||||||
RPCMessageType.WARNING):
|
RPCMessageType.WARNING):
|
||||||
|
@ -274,11 +274,11 @@ def test_send_msg_webhook(default_conf, mocker):
|
|||||||
webhook.send_msg(msg=msg)
|
webhook.send_msg(msg=msg)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert (msg_mock.call_args[0][0]["value1"] ==
|
assert (msg_mock.call_args[0][0]["value1"] ==
|
||||||
default_conf["webhook"]["webhooksellcancel"]["value1"].format(**msg))
|
default_conf["webhook"]["webhookexitcancel"]["value1"].format(**msg))
|
||||||
assert (msg_mock.call_args[0][0]["value2"] ==
|
assert (msg_mock.call_args[0][0]["value2"] ==
|
||||||
default_conf["webhook"]["webhooksellcancel"]["value2"].format(**msg))
|
default_conf["webhook"]["webhookexitcancel"]["value2"].format(**msg))
|
||||||
assert (msg_mock.call_args[0][0]["value3"] ==
|
assert (msg_mock.call_args[0][0]["value3"] ==
|
||||||
default_conf["webhook"]["webhooksellcancel"]["value3"].format(**msg))
|
default_conf["webhook"]["webhookexitcancel"]["value3"].format(**msg))
|
||||||
# Test Sell fill
|
# Test Sell fill
|
||||||
msg_mock.reset_mock()
|
msg_mock.reset_mock()
|
||||||
msg = {
|
msg = {
|
||||||
|
Loading…
Reference in New Issue
Block a user