Improve msgtypes

This commit is contained in:
Matthias
2023-03-24 20:47:17 +01:00
parent e8cffeeffd
commit 8928d3616a
3 changed files with 13 additions and 1 deletions

View File

@@ -15,6 +15,12 @@ class RPCStatusMsg(RPCSendMsgBase):
status: str
class RPCStrategyMsg(RPCSendMsgBase):
"""Used for Status, Startup and Warning messages"""
type: Literal[RPCMessageType.STRATEGY_MSG]
msg: str
class RPCProtectionMsg(RPCSendMsgBase):
type: Literal[RPCMessageType.PROTECTION_TRIGGER, RPCMessageType.PROTECTION_TRIGGER_GLOBAL]
id: int
@@ -40,6 +46,7 @@ class __RPCBuyMsgBase(RPCSendMsgBase):
enter_tag: Optional[str]
exchange: str
pair: str
base_currency: str
leverage: Optional[float]
direction: str
limit: float
@@ -90,6 +97,7 @@ class RPCSellCancelMsg(__RPCBuyMsgBase):
RPCSendMsg = Union[
RPCStatusMsg,
RPCStrategyMsg,
RPCProtectionMsg,
RPCWhitelistMsg,
RPCBuyMsg,

View File

@@ -437,7 +437,7 @@ class Telegram(RPCHandler):
msg_type = msg['type']
noti = ''
if msg_type == RPCMessageType.EXIT:
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