From 76d289f0cecb504c18e678cf06c93cbefab5ca0d Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 24 Mar 2023 20:35:01 +0100 Subject: [PATCH] Don't overwrite types --- freqtrade/rpc/rpc_types.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/freqtrade/rpc/rpc_types.py b/freqtrade/rpc/rpc_types.py index b81591954..a43cfd34e 100644 --- a/freqtrade/rpc/rpc_types.py +++ b/freqtrade/rpc/rpc_types.py @@ -34,8 +34,7 @@ class RPCWhitelistMsg(RPCSendMsgBase): data: List[str] -class RPCBuyMsg(RPCSendMsgBase): - type: Literal[RPCMessageType.ENTRY, RPCMessageType.ENTRY_FILL] +class __RPCBuyMsgBase(RPCSendMsgBase): trade_id: int buy_tag: Optional[str] enter_tag: Optional[str] @@ -55,12 +54,16 @@ class RPCBuyMsg(RPCSendMsgBase): sub_trade: bool -class RPCCancelMsg(RPCBuyMsg): +class RPCBuyMsg(__RPCBuyMsgBase): + type: Literal[RPCMessageType.ENTRY, RPCMessageType.ENTRY_FILL] + + +class RPCCancelMsg(__RPCBuyMsgBase): type: Literal[RPCMessageType.ENTRY_CANCEL] reason: str -class RPCSellMsg(RPCBuyMsg): +class RPCSellMsg(__RPCBuyMsgBase): type: Literal[RPCMessageType.EXIT, RPCMessageType.EXIT_FILL] cumulative_profit: float gain: str # Literal["profit", "loss"] @@ -74,7 +77,7 @@ class RPCSellMsg(RPCBuyMsg): order_rate: Optional[float] -class RPCSellCancelMsg(RPCBuyMsg): +class RPCSellCancelMsg(__RPCBuyMsgBase): type: Literal[RPCMessageType.EXIT_CANCEL] reason: str gain: str # Literal["profit", "loss"]