Update telegram notification settings

This commit is contained in:
Matthias
2022-04-04 19:10:44 +02:00
parent 0b88185c2c
commit 8a9839fb6d
11 changed files with 28 additions and 24 deletions

View File

@@ -291,7 +291,7 @@ CONF_SCHEMA = {
'enum': TELEGRAM_SETTING_OPTIONS,
'default': 'off'
},
'sell': {
'exit': {
'type': ['string', 'object'],
'additionalProperties': {
'type': 'string',

View File

@@ -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'

View File

@@ -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,

View File

@@ -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

View File

@@ -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))