fix bug
This commit is contained in:
@@ -68,6 +68,7 @@ class OrderItem:
|
||||
class PositionItem:
|
||||
stock_code: str = ""
|
||||
stock_name: str = ""
|
||||
trade_id:str = ""
|
||||
direction: Any = None
|
||||
volume: int = 0
|
||||
open_price: float = 0.0
|
||||
@@ -87,6 +88,7 @@ class PositionItem:
|
||||
def from_dict(cls, data: dict[str, Any], code: str = "") -> "PositionItem":
|
||||
return cls(
|
||||
stock_code=str(data.get("StockCode") or code), stock_name=str(data.get("StockName") or ""),
|
||||
trade_id=str(data.get("TradeID") or ""),
|
||||
direction=data.get("Direction"), volume=_number(data.get("Volume"), int),
|
||||
open_price=_number(data.get("OpenPrice")), float_profit=_number(data.get("FloatProfit")),
|
||||
market_value=_number(data.get("MarketValue")), stock_holder=str(data.get("StockHolder") or ""),
|
||||
@@ -102,6 +104,7 @@ class PositionItem:
|
||||
return cls(
|
||||
stock_code=str(data.get("StockCode") or ""),
|
||||
stock_name=str(data.get("StockName") or ""),
|
||||
trade_id=str(data.get("TradeID") or ""),
|
||||
direction=data.get("Direction"),
|
||||
volume=_number(data.get("Volume"), int),
|
||||
open_price=_number(data.get("OpenPrice")),
|
||||
|
||||
Reference in New Issue
Block a user