Update RPC message types to ENTRY

This commit is contained in:
Matthias
2022-04-04 19:29:15 +02:00
parent 125dff1dad
commit eff636ba53
12 changed files with 64 additions and 71 deletions

View File

@@ -1771,10 +1771,10 @@ def test_show_config_handle(default_conf, update, mocker) -> None:
@pytest.mark.parametrize('message_type,enter,enter_signal,leverage', [
(RPCMessageType.BUY, 'Long', 'long_signal_01', None),
(RPCMessageType.BUY, 'Long', 'long_signal_01', 1.0),
(RPCMessageType.BUY, 'Long', 'long_signal_01', 5.0),
(RPCMessageType.SHORT, 'Short', 'short_signal_01', 2.0)])
(RPCMessageType.ENTRY, 'Long', 'long_signal_01', None),
(RPCMessageType.ENTRY, 'Long', 'long_signal_01', 1.0),
(RPCMessageType.ENTRY, 'Long', 'long_signal_01', 5.0),
(RPCMessageType.ENTRY, 'Short', 'short_signal_01', 2.0)])
def test_send_msg_buy_notification(default_conf, mocker, caplog, message_type,
enter, enter_signal, leverage) -> None:
@@ -1827,8 +1827,8 @@ def test_send_msg_buy_notification(default_conf, mocker, caplog, message_type,
@pytest.mark.parametrize('message_type,enter_signal', [
(RPCMessageType.BUY_CANCEL, 'long_signal_01'),
(RPCMessageType.SHORT_CANCEL, 'short_signal_01')])
(RPCMessageType.ENTRY_CANCEL, 'long_signal_01'),
(RPCMessageType.ENTRY_CANCEL, 'short_signal_01')])
def test_send_msg_buy_cancel_notification(default_conf, mocker, message_type, enter_signal) -> None:
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
@@ -1875,14 +1875,14 @@ def test_send_msg_protection_notification(default_conf, mocker, time_machine) ->
@pytest.mark.parametrize('message_type,entered,enter_signal,leverage', [
(RPCMessageType.BUY_FILL, 'Longed', 'long_signal_01', 1.0),
(RPCMessageType.BUY_FILL, 'Longed', 'long_signal_02', 2.0),
(RPCMessageType.SHORT_FILL, 'Shorted', 'short_signal_01', 2.0),
(RPCMessageType.ENTRY_FILL, 'Longed', 'long_signal_01', 1.0),
(RPCMessageType.ENTRY_FILL, 'Longed', 'long_signal_02', 2.0),
(RPCMessageType.ENTRY_FILL, 'Shorted', 'short_signal_01', 2.0),
])
def test_send_msg_buy_fill_notification(default_conf, mocker, message_type, entered,
def test_send_msg_entry_fill_notification(default_conf, mocker, message_type, entered,
enter_signal, leverage) -> None:
default_conf['telegram']['notification_settings']['buy_fill'] = 'on'
default_conf['telegram']['notification_settings']['entry_fill'] = 'on'
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
telegram.send_msg({
@@ -2105,9 +2105,9 @@ def test_send_msg_unknown_type(default_conf, mocker) -> None:
@pytest.mark.parametrize('message_type,enter,enter_signal,leverage', [
(RPCMessageType.BUY, 'Long', 'long_signal_01', None),
(RPCMessageType.BUY, 'Long', 'long_signal_01', 2.0),
(RPCMessageType.SHORT, 'Short', 'short_signal_01', 2.0)])
(RPCMessageType.ENTRY, 'Long', 'long_signal_01', None),
(RPCMessageType.ENTRY, 'Long', 'long_signal_01', 2.0),
(RPCMessageType.ENTRY, 'Short', 'short_signal_01', 2.0)])
def test_send_msg_buy_notification_no_fiat(
default_conf, mocker, message_type, enter, enter_signal, leverage) -> None:
del default_conf['fiat_display_currency']

View File

@@ -74,7 +74,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock = MagicMock()
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
msg = {
'type': RPCMessageType.BUY,
'type': RPCMessageType.ENTRY,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 1.0,
@@ -101,7 +101,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock.reset_mock()
msg = {
'type': RPCMessageType.SHORT,
'type': RPCMessageType.ENTRY,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 2.0,
@@ -128,7 +128,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock.reset_mock()
msg = {
'type': RPCMessageType.BUY_CANCEL,
'type': RPCMessageType.ENTRY_CANCEL,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 1.0,
@@ -151,7 +151,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock.reset_mock()
msg = {
'type': RPCMessageType.SHORT_CANCEL,
'type': RPCMessageType.ENTRY_CANCEL,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 2.0,
@@ -178,7 +178,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock.reset_mock()
msg = {
'type': RPCMessageType.BUY_FILL,
'type': RPCMessageType.ENTRY_FILL,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 1.0,
@@ -205,7 +205,7 @@ def test_send_msg_webhook(default_conf, mocker):
msg_mock.reset_mock()
msg = {
'type': RPCMessageType.SHORT_FILL,
'type': RPCMessageType.ENTRY_FILL,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'leverage': 2.0,
@@ -330,8 +330,8 @@ def test_exception_send_msg(default_conf, mocker, caplog):
del default_conf["webhook"]["webhookbuy"]
webhook = Webhook(RPC(get_patched_freqtradebot(mocker, default_conf)), default_conf)
webhook.send_msg({'type': RPCMessageType.BUY})
assert log_has(f"Message type '{RPCMessageType.BUY}' not configured for webhooks",
webhook.send_msg({'type': RPCMessageType.ENTRY})
assert log_has(f"Message type '{RPCMessageType.ENTRY}' not configured for webhooks",
caplog)
default_conf["webhook"] = get_webhook_dict()
@@ -340,7 +340,7 @@ def test_exception_send_msg(default_conf, mocker, caplog):
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
webhook = Webhook(RPC(get_patched_freqtradebot(mocker, default_conf)), default_conf)
msg = {
'type': RPCMessageType.BUY,
'type': RPCMessageType.ENTRY,
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 0.005,