From 0b88185c2c6c18b31b36f6f44a00ea3354f18faa Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 4 Apr 2022 19:08:31 +0200 Subject: [PATCH] Sell-fill -> exit_fill --- config_examples/config_full.example.json | 2 +- docs/telegram-usage.md | 4 ++-- freqtrade/constants.py | 2 +- freqtrade/enums/rpcmessagetype.py | 2 +- freqtrade/freqtradebot.py | 2 +- freqtrade/rpc/telegram.py | 6 +++--- freqtrade/rpc/webhook.py | 2 +- tests/rpc/test_rpc_telegram.py | 4 ++-- tests/rpc/test_rpc_webhook.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/config_examples/config_full.example.json b/config_examples/config_full.example.json index 59fa43a4f..7f4c83e21 100644 --- a/config_examples/config_full.example.json +++ b/config_examples/config_full.example.json @@ -151,7 +151,7 @@ "stoploss_on_exchange": "off", "custom_exit": "off" }, - "sell_fill": "on", + "exit_fill": "on", "buy_cancel": "on", "exit_cancel": "on", "protection_trigger": "off", diff --git a/docs/telegram-usage.md b/docs/telegram-usage.md index 929dad80c..3ca5cf70b 100644 --- a/docs/telegram-usage.md +++ b/docs/telegram-usage.md @@ -95,7 +95,7 @@ Example configuration showing the different settings: "buy_cancel": "silent", "exit_cancel": "on", "buy_fill": "off", - "sell_fill": "off", + "exit_fill": "off", "protection_trigger": "off", "protection_trigger_global": "on" }, @@ -105,7 +105,7 @@ Example configuration showing the different settings: ``` `buy` notifications are sent when the order is placed, while `buy_fill` notifications are sent when the order is filled on the exchange. -`sell` notifications are sent when the order is placed, while `sell_fill` notifications are sent when the order is filled on the exchange. +`sell` notifications are sent when the order is placed, while `exit_fill` notifications are sent when the order is filled on the exchange. `*_fill` notifications are off by default and must be explicitly enabled. `protection_trigger` notifications are sent when a protection triggers and `protection_trigger_global` notifications trigger when global protections are triggered. diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 17f812167..6c721c416 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -299,7 +299,7 @@ CONF_SCHEMA = { } }, 'exit_cancel': {'type': 'string', 'enum': TELEGRAM_SETTING_OPTIONS}, - 'sell_fill': { + 'exit_fill': { 'type': 'string', 'enum': TELEGRAM_SETTING_OPTIONS, 'default': 'off' diff --git a/freqtrade/enums/rpcmessagetype.py b/freqtrade/enums/rpcmessagetype.py index 1e1011a94..1ef0e29dc 100644 --- a/freqtrade/enums/rpcmessagetype.py +++ b/freqtrade/enums/rpcmessagetype.py @@ -15,7 +15,7 @@ class RPCMessageType(Enum): SHORT_CANCEL = 'short_cancel' SELL = 'sell' - SELL_FILL = 'sell_fill' + EXIT_FILL = 'exit_fill' EXIT_CANCEL = 'exit_cancel' PROTECTION_TRIGGER = 'protection_trigger' diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 6a34c8e26..e05b25839 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1446,7 +1446,7 @@ class FreqtradeBot(LoggingMixin): gain = "profit" if profit_ratio > 0 else "loss" msg = { - 'type': (RPCMessageType.SELL_FILL if fill + 'type': (RPCMessageType.EXIT_FILL if fill else RPCMessageType.SELL), 'trade_id': trade.id, 'exchange': trade.exchange.capitalize(), diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py index 5ff951bdf..5ea92d94e 100644 --- a/freqtrade/rpc/telegram.py +++ b/freqtrade/rpc/telegram.py @@ -284,7 +284,7 @@ class Telegram(RPCHandler): f" / {msg['profit_fiat']:.3f} {msg['fiat_currency']})") else: msg['profit_extra'] = '' - is_fill = msg['type'] == RPCMessageType.SELL_FILL + is_fill = msg['type'] == RPCMessageType.EXIT_FILL message = ( f"{msg['emoji']} *{msg['exchange']}:* " f"{'Exited' if is_fill else 'Exiting'} {msg['pair']} (#{msg['trade_id']})\n" @@ -302,7 +302,7 @@ class Telegram(RPCHandler): message += (f"*Current Rate:* `{msg['current_rate']:.8f}`\n" f"*Close Rate:* `{msg['limit']:.8f}`") - elif msg['type'] == RPCMessageType.SELL_FILL: + elif msg['type'] == RPCMessageType.EXIT_FILL: message += f"*Close Rate:* `{msg['close_rate']:.8f}`" return message @@ -312,7 +312,7 @@ class Telegram(RPCHandler): RPCMessageType.SHORT_FILL]: message = self._format_buy_msg(msg) - elif msg_type in [RPCMessageType.SELL, RPCMessageType.SELL_FILL]: + elif msg_type in [RPCMessageType.SELL, RPCMessageType.EXIT_FILL]: message = self._format_sell_msg(msg) elif msg_type in (RPCMessageType.BUY_CANCEL, RPCMessageType.SHORT_CANCEL, diff --git a/freqtrade/rpc/webhook.py b/freqtrade/rpc/webhook.py index ef9924ce7..9d2fb880d 100644 --- a/freqtrade/rpc/webhook.py +++ b/freqtrade/rpc/webhook.py @@ -53,7 +53,7 @@ class Webhook(RPCHandler): valuedict = whconfig.get('webhookbuyfill', None) elif msg['type'] == RPCMessageType.SELL: valuedict = whconfig.get('webhookexit', whconfig.get('webhooksell', None)) - elif msg['type'] == RPCMessageType.SELL_FILL: + elif msg['type'] == RPCMessageType.EXIT_FILL: valuedict = whconfig.get('webhookexitfill', whconfig.get('webhookexitfill', None)) elif msg['type'] == RPCMessageType.EXIT_CANCEL: valuedict = whconfig.get('webhookexitcancel', diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 46d0f00de..9961a3357 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -2028,11 +2028,11 @@ def test_send_msg_sell_cancel_notification(default_conf, mocker) -> None: def test_send_msg_sell_fill_notification(default_conf, mocker, direction, enter_signal, leverage) -> None: - default_conf['telegram']['notification_settings']['sell_fill'] = 'on' + default_conf['telegram']['notification_settings']['exit_fill'] = 'on' telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf) telegram.send_msg({ - 'type': RPCMessageType.SELL_FILL, + 'type': RPCMessageType.EXIT_FILL, 'trade_id': 1, 'exchange': 'Binance', 'pair': 'KEY/ETH', diff --git a/tests/rpc/test_rpc_webhook.py b/tests/rpc/test_rpc_webhook.py index 6e1d4ee93..b4c1caac3 100644 --- a/tests/rpc/test_rpc_webhook.py +++ b/tests/rpc/test_rpc_webhook.py @@ -282,7 +282,7 @@ def test_send_msg_webhook(default_conf, mocker): # Test Sell fill msg_mock.reset_mock() msg = { - 'type': RPCMessageType.SELL_FILL, + 'type': RPCMessageType.EXIT_FILL, 'exchange': 'Binance', 'pair': 'ETH/BTC', 'gain': "profit",