Improve msg typing

This commit is contained in:
Matthias 2023-03-06 19:23:05 +01:00
parent 0ece73578c
commit 70ad7b42b1
2 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,6 @@
import logging import logging
from ipaddress import IPv4Address from ipaddress import IPv4Address
from typing import Any, Optional from typing import Any, Dict, Optional
import orjson import orjson
import uvicorn import uvicorn

View File

@ -27,12 +27,12 @@ class RPCProtectionMsg(RPCSendMsgBase):
class RPCBuyMsg(RPCSendMsgBase): class RPCBuyMsg(RPCSendMsgBase):
trade_id: str trade_id: int
buy_tag: str buy_tag: Optional[str]
enter_tag: str enter_tag: Optional[str]
exchange: str exchange: str
pair: str pair: str
leverage: float leverage: Optional[float]
direction: str direction: str
limit: float limit: float
open_rate: float open_rate: float
@ -42,7 +42,7 @@ class RPCBuyMsg(RPCSendMsgBase):
fiat_currency: Optional[str] fiat_currency: Optional[str]
amount: float amount: float
open_date: datetime open_date: datetime
current_rate: float current_rate: Optional[float]
sub_trade: bool sub_trade: bool
@ -56,10 +56,11 @@ class RPCSellMsg(RPCBuyMsg):
close_rate: float close_rate: float
profit_amount: float profit_amount: float
profit_ratio: float profit_ratio: float
sell_reason: str sell_reason: Optional[str]
exit_reason: str exit_reason: Optional[str]
close_date: datetime close_date: datetime
current_rate: Optional[float] # current_rate: Optional[float]
order_rate: Optional[float]
class RPCSellCancelMsg(RPCBuyMsg): class RPCSellCancelMsg(RPCBuyMsg):
@ -67,8 +68,8 @@ class RPCSellCancelMsg(RPCBuyMsg):
gain: str # Literal["profit", "loss"] gain: str # Literal["profit", "loss"]
profit_amount: float profit_amount: float
profit_ratio: float profit_ratio: float
sell_reason: str sell_reason: Optional[str]
exit_reason: str exit_reason: Optional[str]
close_date: datetime close_date: datetime