Don't overwrite types

This commit is contained in:
Matthias 2023-03-24 20:35:01 +01:00
parent 245ae99273
commit 76d289f0ce

View File

@ -34,8 +34,7 @@ class RPCWhitelistMsg(RPCSendMsgBase):
data: List[str] data: List[str]
class RPCBuyMsg(RPCSendMsgBase): class __RPCBuyMsgBase(RPCSendMsgBase):
type: Literal[RPCMessageType.ENTRY, RPCMessageType.ENTRY_FILL]
trade_id: int trade_id: int
buy_tag: Optional[str] buy_tag: Optional[str]
enter_tag: Optional[str] enter_tag: Optional[str]
@ -55,12 +54,16 @@ class RPCBuyMsg(RPCSendMsgBase):
sub_trade: bool sub_trade: bool
class RPCCancelMsg(RPCBuyMsg): class RPCBuyMsg(__RPCBuyMsgBase):
type: Literal[RPCMessageType.ENTRY, RPCMessageType.ENTRY_FILL]
class RPCCancelMsg(__RPCBuyMsgBase):
type: Literal[RPCMessageType.ENTRY_CANCEL] type: Literal[RPCMessageType.ENTRY_CANCEL]
reason: str reason: str
class RPCSellMsg(RPCBuyMsg): class RPCSellMsg(__RPCBuyMsgBase):
type: Literal[RPCMessageType.EXIT, RPCMessageType.EXIT_FILL] type: Literal[RPCMessageType.EXIT, RPCMessageType.EXIT_FILL]
cumulative_profit: float cumulative_profit: float
gain: str # Literal["profit", "loss"] gain: str # Literal["profit", "loss"]
@ -74,7 +77,7 @@ class RPCSellMsg(RPCBuyMsg):
order_rate: Optional[float] order_rate: Optional[float]
class RPCSellCancelMsg(RPCBuyMsg): class RPCSellCancelMsg(__RPCBuyMsgBase):
type: Literal[RPCMessageType.EXIT_CANCEL] type: Literal[RPCMessageType.EXIT_CANCEL]
reason: str reason: str
gain: str # Literal["profit", "loss"] gain: str # Literal["profit", "loss"]