Update telegram notification settings
This commit is contained in:
parent
0b88185c2c
commit
8a9839fb6d
@ -141,7 +141,7 @@
|
||||
"startup": "on",
|
||||
"buy": "on",
|
||||
"buy_fill": "on",
|
||||
"sell": {
|
||||
"exit": {
|
||||
"roi": "off",
|
||||
"emergency_exit": "off",
|
||||
"force_exit": "off",
|
||||
|
@ -51,6 +51,10 @@ You can use the quick summary as checklist. Please refer to the detailed section
|
||||
* `webhooksell` -> `webhookexit`
|
||||
* `webhooksellfill` -> `webhookexitfill`
|
||||
* `webhooksellcancel` -> `webhookexitcancel`
|
||||
* Telegram notification settings
|
||||
* `sell` -> `exit`
|
||||
* `sell_fill` -> `exit_fill`
|
||||
* `sell_cancel` -> `exit_cancel`
|
||||
|
||||
|
||||
|
||||
|
@ -82,7 +82,7 @@ Example configuration showing the different settings:
|
||||
"warning": "on",
|
||||
"startup": "off",
|
||||
"buy": "silent",
|
||||
"sell": {
|
||||
"exit": {
|
||||
"roi": "silent",
|
||||
"emergency_exit": "on",
|
||||
"force_exit": "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 `exit_fill` notifications are sent when the order is filled on the exchange.
|
||||
`exit` 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.
|
||||
|
||||
|
@ -291,7 +291,7 @@ CONF_SCHEMA = {
|
||||
'enum': TELEGRAM_SETTING_OPTIONS,
|
||||
'default': 'off'
|
||||
},
|
||||
'sell': {
|
||||
'exit': {
|
||||
'type': ['string', 'object'],
|
||||
'additionalProperties': {
|
||||
'type': 'string',
|
||||
|
@ -14,7 +14,7 @@ class RPCMessageType(Enum):
|
||||
SHORT_FILL = 'short_fill'
|
||||
SHORT_CANCEL = 'short_cancel'
|
||||
|
||||
SELL = 'sell'
|
||||
EXIT = 'exit'
|
||||
EXIT_FILL = 'exit_fill'
|
||||
EXIT_CANCEL = 'exit_cancel'
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ class FreqtradeBot(LoggingMixin):
|
||||
|
||||
msg = {
|
||||
'type': (RPCMessageType.EXIT_FILL if fill
|
||||
else RPCMessageType.SELL),
|
||||
else RPCMessageType.EXIT),
|
||||
'trade_id': trade.id,
|
||||
'exchange': trade.exchange.capitalize(),
|
||||
'pair': trade.pair,
|
||||
|
@ -298,7 +298,7 @@ class Telegram(RPCHandler):
|
||||
f"*Amount:* `{msg['amount']:.8f}`\n"
|
||||
f"*Open Rate:* `{msg['open_rate']:.8f}`\n"
|
||||
)
|
||||
if msg['type'] == RPCMessageType.SELL:
|
||||
if msg['type'] == RPCMessageType.EXIT:
|
||||
message += (f"*Current Rate:* `{msg['current_rate']:.8f}`\n"
|
||||
f"*Close Rate:* `{msg['limit']:.8f}`")
|
||||
|
||||
@ -312,7 +312,7 @@ class Telegram(RPCHandler):
|
||||
RPCMessageType.SHORT_FILL]:
|
||||
message = self._format_buy_msg(msg)
|
||||
|
||||
elif msg_type in [RPCMessageType.SELL, RPCMessageType.EXIT_FILL]:
|
||||
elif msg_type in [RPCMessageType.EXIT, RPCMessageType.EXIT_FILL]:
|
||||
message = self._format_sell_msg(msg)
|
||||
|
||||
elif msg_type in (RPCMessageType.BUY_CANCEL, RPCMessageType.SHORT_CANCEL,
|
||||
@ -355,7 +355,7 @@ class Telegram(RPCHandler):
|
||||
|
||||
msg_type = msg['type']
|
||||
noti = ''
|
||||
if msg_type == RPCMessageType.SELL:
|
||||
if msg_type == RPCMessageType.EXIT:
|
||||
sell_noti = self._config['telegram'] \
|
||||
.get('notification_settings', {}).get(str(msg_type), {})
|
||||
# For backward compatibility sell still can be string
|
||||
|
@ -51,7 +51,7 @@ class Webhook(RPCHandler):
|
||||
valuedict = whconfig.get('webhookbuycancel', None)
|
||||
elif msg['type'] in [RPCMessageType.BUY_FILL, RPCMessageType.SHORT_FILL]:
|
||||
valuedict = whconfig.get('webhookbuyfill', None)
|
||||
elif msg['type'] == RPCMessageType.SELL:
|
||||
elif msg['type'] == RPCMessageType.EXIT:
|
||||
valuedict = whconfig.get('webhookexit', whconfig.get('webhooksell', None))
|
||||
elif msg['type'] == RPCMessageType.EXIT_FILL:
|
||||
valuedict = whconfig.get('webhookexitfill', whconfig.get('webhookexitfill', None))
|
||||
|
@ -1040,7 +1040,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
|
||||
assert msg_mock.call_count == 4
|
||||
last_msg = msg_mock.call_args_list[-2][0][0]
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/BTC',
|
||||
@ -1109,7 +1109,7 @@ def test_telegram_forcesell_down_handle(default_conf, update, ticker, fee,
|
||||
|
||||
last_msg = msg_mock.call_args_list[-2][0][0]
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/BTC',
|
||||
@ -1168,7 +1168,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
|
||||
assert msg_mock.call_count == 8
|
||||
msg = msg_mock.call_args_list[0][0][0]
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/BTC',
|
||||
@ -1918,7 +1918,7 @@ def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
||||
old_convamount = telegram._rpc._fiat_converter.convert_amount
|
||||
telegram._rpc._fiat_converter.convert_amount = lambda a, b, c: -24.812
|
||||
telegram.send_msg({
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'KEY/ETH',
|
||||
@ -1954,7 +1954,7 @@ def test_send_msg_sell_notification(default_conf, mocker) -> None:
|
||||
|
||||
msg_mock.reset_mock()
|
||||
telegram.send_msg({
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'KEY/ETH',
|
||||
@ -2155,7 +2155,7 @@ def test_send_msg_sell_notification_no_fiat(
|
||||
telegram, _, msg_mock = get_telegram_testobject(mocker, default_conf)
|
||||
|
||||
telegram.send_msg({
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'KEY/ETH',
|
||||
|
@ -232,7 +232,7 @@ def test_send_msg_webhook(default_conf, mocker):
|
||||
msg_mock.reset_mock()
|
||||
|
||||
msg = {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/BTC',
|
||||
'gain': "profit",
|
||||
|
@ -3091,7 +3091,7 @@ def test_execute_trade_exit_up(default_conf_usdt, ticker_usdt, fee, ticker_usdt_
|
||||
last_msg = rpc_mock.call_args_list[-1][0][0]
|
||||
assert {
|
||||
'trade_id': 1,
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/USDT',
|
||||
'gain': 'profit',
|
||||
@ -3150,7 +3150,7 @@ def test_execute_trade_exit_down(default_conf_usdt, ticker_usdt, fee, ticker_usd
|
||||
assert rpc_mock.call_count == 2
|
||||
last_msg = rpc_mock.call_args_list[-1][0][0]
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/USDT',
|
||||
@ -3232,7 +3232,7 @@ def test_execute_trade_exit_custom_exit_price(
|
||||
last_msg = rpc_mock.call_args_list[-1][0][0]
|
||||
assert {
|
||||
'trade_id': 1,
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/USDT',
|
||||
'direction': 'Short' if trade.is_short else 'Long',
|
||||
@ -3299,7 +3299,7 @@ def test_execute_trade_exit_down_stoploss_on_exchange_dry_run(
|
||||
last_msg = rpc_mock.call_args_list[-1][0][0]
|
||||
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/USDT',
|
||||
@ -3490,12 +3490,12 @@ def test_may_execute_trade_exit_after_stoploss_on_exchange_hit(
|
||||
if is_short:
|
||||
assert rpc_mock.call_args_list[0][0][0]['type'] == RPCMessageType.SHORT
|
||||
assert rpc_mock.call_args_list[1][0][0]['type'] == RPCMessageType.SHORT_FILL
|
||||
assert rpc_mock.call_args_list[2][0][0]['type'] == RPCMessageType.SELL
|
||||
assert rpc_mock.call_args_list[2][0][0]['type'] == RPCMessageType.EXIT
|
||||
|
||||
else:
|
||||
assert rpc_mock.call_args_list[0][0][0]['type'] == RPCMessageType.BUY
|
||||
assert rpc_mock.call_args_list[1][0][0]['type'] == RPCMessageType.BUY_FILL
|
||||
assert rpc_mock.call_args_list[2][0][0]['type'] == RPCMessageType.SELL
|
||||
assert rpc_mock.call_args_list[2][0][0]['type'] == RPCMessageType.EXIT
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -3563,7 +3563,7 @@ def test_execute_trade_exit_market_order(
|
||||
assert rpc_mock.call_count == 3
|
||||
last_msg = rpc_mock.call_args_list[-2][0][0]
|
||||
assert {
|
||||
'type': RPCMessageType.SELL,
|
||||
'type': RPCMessageType.EXIT,
|
||||
'trade_id': 1,
|
||||
'exchange': 'Binance',
|
||||
'pair': 'ETH/USDT',
|
||||
|
Loading…
Reference in New Issue
Block a user