From 99d2d0cf799318b3bc337a92093bfb8cc3967804 Mon Sep 17 00:00:00 2001 From: msincenselee Date: Sun, 19 Jan 2020 17:14:07 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=A2=9E=E5=BC=BA]=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=8E=9F=E5=A7=8B=E5=A7=94=E6=89=98=E7=BC=96?= =?UTF-8?q?=E5=8F=B7=EF=BC=8C=E5=A2=9E=E5=8A=A0=E8=82=A1=E7=A5=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/object.py | 45 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/vnpy/trader/object.py b/vnpy/trader/object.py index 04b2943c..d96eede2 100644 --- a/vnpy/trader/object.py +++ b/vnpy/trader/object.py @@ -128,6 +128,7 @@ class OrderData(BaseData): symbol: str exchange: Exchange orderid: str + sys_orderid: str = "" type: OrderType = OrderType.LIMIT direction: Direction = "" @@ -174,6 +175,8 @@ class TradeData(BaseData): exchange: Exchange orderid: str tradeid: str + sys_orderid: str = "" + direction: Direction = "" offset: Offset = Offset.NONE @@ -181,7 +184,13 @@ class TradeData(BaseData): volume: float = 0 time: str = "" datetime: datetime = None - strategy_name: str = "" + strategy_name: str = "" # 策略名 + + # 股票使用 + trade_amount: float = 0 # 成交金额 + commission: float = 0 # 手续费(印花税+佣金+过户费) + holder_id: str = "" # 股东代码 + comment: str = "" # 备注 def __post_init__(self): """""" @@ -206,6 +215,9 @@ class PositionData(BaseData): pnl: float = 0 yd_volume: float = 0 + # 股票相关 + holder_id: str = "" # 股东代码 + def __post_init__(self): """""" self.vt_symbol = f"{self.symbol}.{self.exchange.value}" @@ -236,6 +248,36 @@ class AccountData(BaseData): self.vt_accountid = f"{self.gateway_name}.{self.accountid}" +@dataclass +class VtFundsFlowData(BaseData): + """历史资金流水数据类(股票专用)""" + + # 账号代码相关 + accountid: str # 账户代码 + exchange: Exchange = None + + currency: str = "" # 币种 + trade_date: str = "" # 成交日期 + trade_price: float = 0 # 成交价格 + trade_volume: float = 0 # 成交数量 + trade_amount: float = 0 # 发生金额( 正数代表卖出,或者转入资金,获取分红等,负数代表买入股票或者出金) + fund_remain: float = 0 # 资金余额 + contract_id: str = "" # 合同编号 + business_name: str = "" # 业务名称 + symbol: str = "" # 合约代码(证券代码) + holder_id: str = "" # 股东代码 + direction: str = "" # 买卖类别:转,买,卖.. + comment: str = "" # 备注 + + def __post_init__(self): + if self.exchange: + self.vt_symbol = f"{self.symbol}.{self.exchange.value}" + else: + self.vt_symbol = self.symbol + + self.vt_accountid = f"{self.gateway_name}.{self.accountid}" + + @dataclass class LogData(BaseData): """ @@ -244,6 +286,7 @@ class LogData(BaseData): msg: str level: int = INFO + additional_info: str = "" def __post_init__(self): """"""