diff --git a/vn.trader/ctaAlgo/ctaBacktesting.py b/vn.trader/ctaAlgo/ctaBacktesting.py index 14a3095b..143e1a40 100644 --- a/vn.trader/ctaAlgo/ctaBacktesting.py +++ b/vn.trader/ctaAlgo/ctaBacktesting.py @@ -531,7 +531,7 @@ if __name__ == '__main__': engine.setBacktestingMode(engine.BAR_MODE) # 设置回测用的数据起始日期 - engine.setStartDate('20120101') + engine.setStartDate('20110101') # 载入历史数据到引擎中 engine.loadHistoryData(MINUTE_DB_NAME, 'IF0000') diff --git a/vn.trader/ctpGateway/ctpGateway.py b/vn.trader/ctpGateway/ctpGateway.py index 99bd42bf..7cafd021 100644 --- a/vn.trader/ctpGateway/ctpGateway.py +++ b/vn.trader/ctpGateway/ctpGateway.py @@ -498,7 +498,7 @@ class CtpTdApi(TdApi): # 否则,推送错误信息 else: err = VtErrorData() - err.gatewayName = self.gateway + err.gatewayName = self.gatewayName err.errorID = error['ErrorID'] err.errorMsg = error['ErrorMsg'].decode('gbk') self.gateway.onError(err) diff --git a/vn.trader/uiMainWindow.py b/vn.trader/uiMainWindow.py index 78781ad3..91b88950 100644 --- a/vn.trader/uiMainWindow.py +++ b/vn.trader/uiMainWindow.py @@ -80,7 +80,10 @@ class MainWindow(QtGui.QMainWindow): connectKsotpAction.triggered.connect(self.connectKsotp) connectFemasAction = QtGui.QAction(u'连接飞马', self) - connectFemasAction.triggered.connect(self.connectFemas) + connectFemasAction.triggered.connect(self.connectFemas) + + connectXspeedAction = QtGui.QAction(u'连接飞创', self) + connectXspeedAction.triggered.connect(self.connectXspeed) connectKsgoldAction = QtGui.QAction(u'连接金仕达黄金', self) connectKsgoldAction.triggered.connect(self.connectKsgold) @@ -122,6 +125,7 @@ class MainWindow(QtGui.QMainWindow): sysMenu.addAction(connectCtpAction) sysMenu.addAction(connectLtsAction) sysMenu.addAction(connectFemasAction) + sysMenu.addAction(connectXspeedAction) sysMenu.addAction(connectKsotpAction) sysMenu.addAction(connectKsgoldAction) sysMenu.addAction(connectSgitAction) @@ -195,7 +199,12 @@ class MainWindow(QtGui.QMainWindow): def connectFemas(self): """连接飞马接口""" self.mainEngine.connect('FEMAS') - + + #---------------------------------------------------------------------- + def connectXspeed(self): + """连接飞马接口""" + self.mainEngine.connect('XSPEED') + #---------------------------------------------------------------------- def connectKsgold(self): """连接金仕达黄金接口""" diff --git a/vn.trader/vtEngine.py b/vn.trader/vtEngine.py index 8f808f35..f8d4de5d 100644 --- a/vn.trader/vtEngine.py +++ b/vn.trader/vtEngine.py @@ -68,7 +68,14 @@ class MainEngine(object): self.gatewayDict['FEMAS'].setQryEnabled(True) except Exception, e: print e - + + try: + from xspeedGateway.xspeedGateway import XspeedGateway + self.addGateway(XspeedGateway, 'XSPEED') + self.gatewayDict['XSPEED'].setQryEnabled(True) + except Exception, e: + print e + try: from ksgoldGateway.ksgoldGateway import KsgoldGateway self.addGateway(KsgoldGateway, 'KSGOLD') diff --git a/vn.trader/vtFunction.py b/vn.trader/vtFunction.py index 3ccaf9b4..4ec3942d 100644 --- a/vn.trader/vtFunction.py +++ b/vn.trader/vtFunction.py @@ -6,7 +6,7 @@ import decimal -MAX_NUMBER = 1000000000 +MAX_NUMBER = 10000000000000 MAX_DECIMAL = 4 #---------------------------------------------------------------------- diff --git a/vn.trader/xspeedGateway/DFITCMdApi.dll b/vn.trader/xspeedGateway/DFITCMdApi.dll new file mode 100644 index 00000000..618ed9cd Binary files /dev/null and b/vn.trader/xspeedGateway/DFITCMdApi.dll differ diff --git a/vn.trader/xspeedGateway/DFITCTraderApi.dll b/vn.trader/xspeedGateway/DFITCTraderApi.dll new file mode 100644 index 00000000..e0acdab1 Binary files /dev/null and b/vn.trader/xspeedGateway/DFITCTraderApi.dll differ diff --git a/vn.trader/xspeedGateway/XSPEED_connect.json b/vn.trader/xspeedGateway/XSPEED_connect.json new file mode 100644 index 00000000..f27672e8 --- /dev/null +++ b/vn.trader/xspeedGateway/XSPEED_connect.json @@ -0,0 +1,6 @@ +{ + "tdAddress": "tcp://203.187.171.250:10910", + "password": "123", + "mdAddress": "tcp://203.187.171.250:10915", + "accountID": "000200002874" +} \ No newline at end of file diff --git a/vn.trader/xspeedGateway/__init__.py b/vn.trader/xspeedGateway/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/vn.trader/xspeedGateway/vnxspeedmd.pyd b/vn.trader/xspeedGateway/vnxspeedmd.pyd new file mode 100644 index 00000000..f142b31e Binary files /dev/null and b/vn.trader/xspeedGateway/vnxspeedmd.pyd differ diff --git a/vn.trader/xspeedGateway/vnxspeedtd.pyd b/vn.trader/xspeedGateway/vnxspeedtd.pyd new file mode 100644 index 00000000..39eefaf6 Binary files /dev/null and b/vn.trader/xspeedGateway/vnxspeedtd.pyd differ diff --git a/vn.trader/xspeedGateway/xspeedDataType.py b/vn.trader/xspeedGateway/xspeedDataType.py new file mode 100644 index 00000000..4a72d915 --- /dev/null +++ b/vn.trader/xspeedGateway/xspeedDataType.py @@ -0,0 +1,954 @@ +# encoding: UTF-8 + +defineDict = {} +typedefDict = {} + + +#///////////////////////////////////////////////////////// +#DFITCUserIDType:用户ID数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCUserIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCAccountIDType:资金账户数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCAccountIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCExecStateType:执行状态数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCExecStateType"] = "int" +#成功 +defineDict["DFITC_SUCCESS"] = 0 +#失败 +defineDict["DFITC_FAIL"] = 1 + + +#///////////////////////////////////////////////////////// +#DFITCClientIDType:交易编码数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCClientIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCClientStatusType:交易编码状态数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCClientStatusType"] = "int" +#禁止开新仓 +defineDict["DFITC_PROHIBIT_OPEN"] = 4 +#允许开新仓 +defineDict["DFITC_ALLOW_OPEN"] = 5 + + +#///////////////////////////////////////////////////////// +#DFITCInstrumentIDType:合约代码数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentIDType"] = "string" + +#///////////////////////////////////////////////////////// +#DFITCInstrumentPrefixType:品种名称数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentPrefixType"] = "string" + +#///////////////////////////////////////////////////////// +#DFITCVarietyNameType:品种名称数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCVarietyNameType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCInstrumentNameType:合约名称数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentNameType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCActiveContractType:有效合约数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCActiveContractType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCLocalOrderIDType:本地委托号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCLocalOrderIDType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCPriceType:价格数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCPriceType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCAmountType:委托数量数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCAmountType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCBuySellTypeType:买卖数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCBuySellTypeType"] = "short" +#买 +defineDict["DFITC_SPD_BUY"] = 1 +#卖 +defineDict["DFITC_SPD_SELL"] = 2 + + +#///////////////////////////////////////////////////////// +#DFITCOpenCloseTypeType:开平标志数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOpenCloseTypeType"] = "int" +#开仓 +defineDict["DFITC_SPD_OPEN"] = 1 +#平仓 +defineDict["DFITC_SPD_CLOSE"] = 2 +#平今 +defineDict["DFITC_SPD_CLOSETODAY"] = 4 +#期权执行 +defineDict["DFITC_SPD_EXECUTE"] = 6 +#期权放弃 +defineDict["DFITC_SPD_GIVEUP"] = 7 +#期权履约 +defineDict["DFITC_SPD_PERFORM"] = 8 +#询价 +defineDict["DFITC_SPD_OPTQRYPRICE"] = 9 +#强平 +defineDict["DFITC_SPD_FORCECLOSE"] = 12 +#强平今 +defineDict["DFITC_SPD_FORCECLOSETODAY"] = 14 + + +#///////////////////////////////////////////////////////// +#DFITCSpeculationValueType:投机保值数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSpeculationValueType"] = "short" + + +#///////////////////////////////////////////////////////// +#DFITCExchangeIDType:交易所编码数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCExchangeIDType"] = "string" +#大商所 +defineDict["DFITC_EXCHANGE_DCE"] = "DCE" +#郑商所 +defineDict["DFITC_EXCHANGE_CZCE"] = "CZCE" +#上期所 +defineDict["DFITC_EXCHANGE_SHFE"] = "SHFE" +#中金所 +defineDict["DFITC_EXCHANGE_CFFEX"] = "CFFEX" +#上能所 +defineDict["DFITC_EXCHANGE_INE"] = "INE" + + +#///////////////////////////////////////////////////////// +#DFITCFrontAddrType:前置机地址数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCFrontAddrType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCCompanyIDType:开发商代码数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCompanyIDType"] = "short" + + +#///////////////////////////////////////////////////////// +#DFITCPasswdType:用户密码数据类型 +#柜台端密码不能为空且有效长度最大为16位 +#///////////////////////////////////////////////////////// +typedefDict["DFITCPasswdType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCSPDOrderIDType:柜台委托号数据类型 +#柜台委托号和条件单号使用相同字段表示 +#当DFITCSPDOrderIDType的取值为正数[最小为1 ],表示为柜台委 +#托号,该笔报单已经到柜台 +#当DFITCSPDOrderIDType的取值为负数[最大为-2],标示为条件单 +#号,该笔报单在条件单模块 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSPDOrderIDType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCOrderSysIDType:报单编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOrderSysIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCOrderType:报单类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOrderTypeType"] = "int" +#限价委托 +defineDict["DFITC_LIMITORDER"] = 1 +#市价委托 +defineDict["DFITC_MKORDER"] = 2 +#套利委托 +defineDict["DFITC_ARBITRAGE"] = 4 +#展期互换委托 +defineDict["DFITC_EXTENSION"] = 8 +#限价止盈委托 +defineDict["DFITC_PROFIT_LIMITORDER"] = 32 +#市价止盈委托 +defineDict["DFITC_PROFIT_MKORDER"] = 34 +#限价止损委托 +defineDict["DFITC_LOSS_LIMITORDER"] = 48 +#市价止损委托 +defineDict["DFITC_LOSS_MKORDER"] = 50 + +#///////////////////////////////////////////////////////// +#DFITCOrderAnswerStatusType:委托回报类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOrderAnswerStatusType"] = "short" +#全部撤单 +defineDict["DFITC_SPD_CANCELED"] = 1 +#全部成交 +defineDict["DFITC_SPD_FILLED"] = 2 +#未成交还在队列中 +defineDict["DFITC_SPD_IN_QUEUE"] = 3 +#部分成交还在队列中 +defineDict["DFITC_SPD_PARTIAL"] = 4 +#部成部撤 +defineDict["DFITC_SPD_PARTIAL_CANCELED"] = 5 +#撤单中 +defineDict["DFITC_SPD_IN_CANCELING"] = 6 +#错误(废单错误) +defineDict["DFITC_SPD_ERROR"] = 7 +#未成交不在队列中 +defineDict["DFITC_SPD_PLACED"] = 8 +#柜台已接收,但尚未到交易所 +defineDict["DFITC_SPD_TRIGGERED"] = 10 + + +#//////////////////////////////////////////////////////////// +#基于算法单模块新增 +#//////////////////////////////////////////////////////////// + +#未触发 +defineDict["DFITC_EXT_UNTRIGGER"] = 13 +#部分触发 +defineDict["DFITC_EXT_PART_TRIGGER"] = 14 +#全部触发 +defineDict["DFITC_EXT_ALL_TRIGGER"] = 15 +#已经撤单 +defineDict["DFITC_EXT_CANCELLED"] = 16 +#报单失败 +defineDict[""] = 17 + + +#///////////////////////////////////////////////////////// +#DFITCMatchIDType:成交编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCMatchIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCDateType:时间数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCDateType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCMatchType:成交类型数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCMatchType"] = "long" +#普通成交 +defineDict["DFITC_BASIC_TRADE"] = 0 + + +#///////////////////////////////////////////////////////// +#DFITCSpeculatorType:投保类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSpeculatorType"] = "int" +#投机 +defineDict["DFITC_SPD_SPECULATOR"] = 0 +#套保 +defineDict["DFITC_SPD_HEDGE"] = 1 +#套利 +defineDict["DFITC_SPD_ARBITRAGE"] = 2 + + +#///////////////////////////////////////////////////////// +#DFITCFeeType:手续费数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCFeeType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCErrorIDType:错误数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCErrorIDType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCErrorMsgInfoType:错误信息数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCErrorMsgInfoType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCMsgInfoType:消息信息数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCMsgInfoType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCEquityType:权益数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCEquityType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCProfitLossType:盈亏数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCProfitLossType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCAccountLoginResultType:资金账户登录结果 +#///////////////////////////////////////////////////////// +typedefDict["DFITCAccountLoginResultType"] = "int" +#登录成功 +defineDict["DFITC_LOGIN_SUCCESS"] = 0 +#登录失败 +defineDict["DFITC_LOGIN_FAILED"] = 1 +#已退出 +defineDict["DFITC_LOGIN_QUIT"] = 2 +#未操作 +defineDict["DFITC_LOGIN_NOT_OPERATE"] = 9 + + +#///////////////////////////////////////////////////////// +#DFITCSessionIDType:SessionID数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSessionIDType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCAccountLogoutResultType:资金帐号登出结果 +#///////////////////////////////////////////////////////// +typedefDict["DFITCAccountLogoutResultType"] = "int" +#登出成功 +defineDict["DFITC_LOGOUT_SUCCESS"] = 0 +#登出失败 +defineDict["DFITC_LOGOUT_FAILED"] = 1 + + +#///////////////////////////////////////////////////////// +#DFITCUserTypeType:用户类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCUserTypeType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCCounterIDType:柜台编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCounterIDType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCRiskDegreeType:风险度数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCRiskDegreeType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCMilliSecType:微秒数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCMilliSecType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCDeltaType:虚实度数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCDeltaType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCVolumeType:数量数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCVolumeType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCFrontIDType:前置机编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCFrontIDType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCOfferPriceLimitType:报价数据上限数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOfferPriceLimitType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCOrderNumType:委托号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOrderNumType"] = "short" + + +#///////////////////////////////////////////////////////// +#DFITCRatioType:比率数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCRatioType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCPremiumType:权利金 +#///////////////////////////////////////////////////////// +typedefDict["DFITCPremiumType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCMarketValueType:期权市值 +#///////////////////////////////////////////////////////// +typedefDict["DFITCMarketValueType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCTimeType:交易所时间 +#///////////////////////////////////////////////////////// +typedefDict["DFITCTimeType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCAbiPolicyCodeType: 套利策略代码数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCAbiPolicyCodeType"] = "string" +#跨期套利 +defineDict["DFITC_SP"] = "SP" +#两腿跨品种套利 +defineDict["DFITC_SP_SPC"] = "SPC" +#压榨套利 +defineDict["DFITC_SP_SPX"] = "SPX" +#Call Spread +defineDict["DFITC_SP_CALL"] = "CSPR" +#Put Spread +defineDict["DFITC_SP_PUT"] = "PSPR" +#Combo +defineDict["DFITC_SP_COMBO"] = "COMBO" +#Straddle +defineDict["DFITC_SP_STRADDLE"] = "STD" +#Strangle +defineDict["DFITC_SP_STRANGLE"] = "STG" +#Guts +defineDict["DFITC_SP_GUTS"] = "GUTS" +#Synthetic Underlying +defineDict["DFITC_SP_SYNUND"] = "SYN" + + +#///////////////////////////////////////////////////////// +#DFITCOrderPropertyType:订单属性 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOrderPropertyType"] = "char" +#无订单属性 +defineDict["DFITC_SP_NON"] = '0' +#FAK设置 +defineDict["DFITC_SP_FAK"] = '1' +#FOK设置 +defineDict["DFITC_SP_FOK"] = '2' +#市价任意价 +defineDict["DFITC_SP_ANYPRICE"] = '3' +#市价任意价转限价 +defineDict["DFITC_SP_ANYPRICE_TO_MKORDER"] = '4' +#五档市价 +defineDict["DFITC_SP_FIVELEVELPRICE"] = '5' +#五档市价转限价 +defineDict["DFITC_SP_FIVELEVELPRICE_TO_LIMIT"] = '6' +#最优价 +defineDict["DFITC_SP_BESTPRICE"] = '7' +#最优价转限价 +defineDict["DFITC_SP_BESTPRICE_TO_LIMIT"] = '8' + + + +#///////////////////////////////////////////////////////// +#DFITCInsertType:委托类别 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInsertType"] = "int" +#普通委托单 +defineDict["DFITC_BASIC_ORDER"] = 0x0001 +#自动单 +defineDict["DFITC_AUTO_ORDER"] = 0x0002 + + +#///////////////////////////////////////////////////////// +#DFITCOptionTypeType:期权类别数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCOptionTypeType"] = "int" +#看涨 +defineDict["DFITC_OPT_CALL"] = 1 +#看跌 +defineDict["DFITC_OPT_PUT"] = 2 + + +#///////////////////////////////////////////////////////// +#DFITCInstrumentTypeType:合约类型数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentTypeType"] = "int" +#期货 +defineDict["DFITC_COMM_TYPE"] = 0 +#期权 +defineDict["DFITC_OPT_TYPE"] = 1 + + +#///////////////////////////////////////////////////////// +#DFITCCancelTypeType:撤销标志数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCancelTypeType"] = "char" +#订单 +defineDict["DFITC_ORDER_BOOK"] = 'O' +#撤销 +defineDict["DFITC_ORDER_CANCEL"] = 'W' + + +#///////////////////////////////////////////////////////// +#DFITCContentType:消息正文数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCContentType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCInstrumentStatusType:合约交易状态数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentStatusType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCInstStatusEnterReasonType:进入本状态原因数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstStatusEnterReasonType"] = "short" + + +#///////////////////////////////////////////////////////// +#DFITCCurrencyType:币种数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCurrencyType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCConfirmType:确认标志数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCConfirmMarkType"] = "int" +#确认 +defineDict["DFITC_CON_CONFIRM"] = 2 + + +#///////////////////////////////////////////////////////// +#DFITCStanAddrType:备用地址数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCStanAddrType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCCapControlModeType:资金控制方式数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCapControlModeType"] = "long" +#盯市盈亏可用 +defineDict["DFITC_PPL_USABLE"] = 2 +#平仓资金T+1可用 +defineDict[""] = 4 +#平仓保证金可取 +defineDict[""] = 8 +#本日盈亏可取 +defineDict[""] = 16 +#取后权益大于本日总入金 +defineDict[""] = 32 +#平仓盈亏可取 +defineDict[""] = 128 +#权利金收入可取 +defineDict[""] = 256 + + +#///////////////////////////////////////////////////////// +#DFITCArchRatioType:转存比例数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCArchRatioType"] = "float" + + +#///////////////////////////////////////////////////////// +#DFITCSettlementBillTradeType:汇总标志数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSettlementBillTradeType"] = "int" +#汇总成交明细 +defineDict["DFITC_MATCHDETAIL"] = 2 +#汇总持仓盈亏 +defineDict["DFITC_OPGAL"] = 4 +#汇总平仓盈亏 +defineDict["DFITC_OFGAL"] = 8 + + +#///////////////////////////////////////////////////////// +#DFITCFilesFlagType:档案类型数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCFilesFlagType"] = "int" +#成交明细打印 +defineDict["DFITC_PRINT_MATCHDETAIL"] = 4 +#持仓盈亏打印 +defineDict["DFITC_PRINT_OPGAL"] = 8 +#平仓盈亏打印 +defineDict["DFITC_PRINT_OFGAL"] = 16 +#资金出入打印 +defineDict["DFITC_PRINT_ACCESSFUNDS"] = 32 +#追保声明打印 +defineDict["DFITC_PRINT_ADDMARGIN"] = 64 + + +#///////////////////////////////////////////////////////// +#DFITCSoftwareVendorIDType:软件供应商编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSoftwareVendorIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCProductOnlineCountType:产品在线数量数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCProductOnlineCountType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCBrokerInfoType:期货公司名称数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCBrokerInfoType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCProductIDType:产品编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCProductIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCRequestIDType:请求ID数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCRequestIDType"] = "long" + + +#///////////////////////////////////////////////////////// +#DFITCCustomCategoryType:自定义类别数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCustomCategoryType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCReservedType:预留字段数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCReservedType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCNoticeType:消息数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCNoticeType"] = "short" +#系统广播 +defineDict["DFITC_SYS_BROADCAST_MSG"] = 1 +#指定客户 +defineDict["DFITC_ACCOUNT_ID_MSG"] = 2 + + +#///////////////////////////////////////////////////////// +#DFITCTradingSegmentSNType:交易阶段编号数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCTradingSegmentSNType"] = "int" + + +#/////////////////////////////////////////// +#DFITCExtOrderType:算法单类型数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCExtOrderType"] = "int" + +#预埋单 +defineDict["DFITC_YMORDER"] = 1 +#条件单 +defineDict["DFITC_TJORDER"] = 2 +#跨期套利订单 +defineDict["DFITC_KQTLDD"] = 3 +#跨品种套利订单 +defineDict["DFITC_KPZTLDD"] = 4 +#蝶式套利订单 +defineDict["DFITC_DSTLDD"] = 5 +#自定义套利订单(暂不支持) +defineDict["DFITC_ZDYTLDD"] = 6 + +#/////////////////////////////////////////// +#DFITCTriggerTime:触发时间数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCTriggerTime"] = "string" + + +#/////////////////////////////////////////// +#DFITCPriceReference:价格参照数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCPriceReference"] = "int" + +#参照最新价 +defineDict["DFITC_REF_LASTPRICE"] = 0 +#参照买一价 +defineDict["DFITC_REF_BIDPRICE"] = 1 +#参照卖出价 +defineDict["DFITC_REF_ASKPRICE"] = 2 + +#/////////////////////////////////////////// +#DFITCCompareFlag:比较标志数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCCompareFlag"] = "int" + +#大于 +defineDict["DFITC_CF_GREATER"] = 0 +#大于等于 +defineDict["DFITC_CF_NOTLESS"] = 1 +#小于 +defineDict["DFITC_CF_LESS"] = 2 +#小于等于 +defineDict["DFITC_CF_NOTGREATER"] = 3 + +#/////////////////////////////////////////// +#DFITCOvernightFlag:隔夜标志数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCOvernightFlag"] = "int" + +#隔夜 +defineDict["DFITC_OVERNIGHT"] = 1 +#不隔夜 +defineDict["DFITC_NOT_OVERNIGHT"] = 2 + +#/////////////////////////////////////////// +#DFITCArbitragePrice:套利价格数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCArbitragePrice"] = "float" + + +#/////////////////////////////////////////// +#DFITCExtTriggerCond:触发条件数据类型 +#/////////////////////////////////////////// +typedefDict["DFITCExtTriggerCond"] = "int" + +#价格触发 +defineDict["DFITC_TRIGGER_PRICE"] = 0 +#时间触发 +defineDict["DFITC_TRIGGER_TIME"] = 1 + + +#///////////////////////////////////////////////////////// +#DFITCInstrumentMaturityType:合约最后交易日 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumentMaturityType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCInstrumenExpirationDateType:合约到期日 +#///////////////////////////////////////////////////////// +typedefDict["DFITCInstrumenExpirationDateType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCAdjustmentInfoType:组合或对锁的保证金调整信息 +#格式:[合约代码,买卖标志,投资类别,调整金额;] +#///////////////////////////////////////////////////////// +typedefDict["DFITCAdjustmentInfoType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCQuoteIDType:询价编号 +#///////////////////////////////////////////////////////// +typedefDict["DFITCQuoteIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCSourceType:来源 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSourceType"] = "short" + +#会员 +defineDict["DFITC_SOURCE_MEMBER"] = 0 +#交易所 +defineDict["DFITC_SOURCE_EXCHANGE"] = 1 + + +#///////////////////////////////////////////////////////// +#DFITCSeatCodeType:席位代码 +#///////////////////////////////////////////////////////// +typedefDict["DFITCSeatCodeType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCCloseIDType:平仓执行单号 +#///////////////////////////////////////////////////////// +typedefDict["DFITCCloseIDType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCEntrusTellerType:委托柜员 +#///////////////////////////////////////////////////////// +typedefDict["DFITCEntrusTellerType"] = "string" + + +#///////////////////////////////////////////////////////// +#DFITCStayTimeType:停留时间数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCStayTimeType"] = "int" + + +#///////////////////////////////////////////////////////// +#DFITCComputeModeType:计算方式数据类型 +#///////////////////////////////////////////////////////// +typedefDict["DFITCComputeModeType"] = "int" +#绝对数值计算 +defineDict["DFITC_ABSOLUTE_VALUE_COMPUTE"] = 0 +#交易所保证金标准基础上浮动 +defineDict["DFITC_EXCHANGE_MARGIN_BASIS_FLOAT"] = 1 +#交易所保证金结果基础上浮动 +defineDict["DFITC_EXCHANGE_MARGIN_RESULT_FLOAT"] = 2 +#期货保证金标准基础上浮动 +defineDict["DFITC_FUTURES_MARGIN_BASIS_FLOAT"] = 3 + + +#////////////////////////////////////////////////////////////////////// +#DFITCPriceNoteType:期权保证金计算方式 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCPriceNoteType"] = "int" +#按照昨结算价计算 +defineDict["DFITC_CALC_BY_PRESETTLEMENT"] = 1 +#按照最新价计算 +defineDict["DFITC_CALC_BY_LASTPRICE"] = 2 + +#////////////////////////////////////////////////////////////////////// +#DFITCLargeMarginDirectType:大边保证金方向数据类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCLargeMarginDirectType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCBankIDType:银行代码类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCBankIDType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCBankNameType:银行名称类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCBankNameType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCBankSerialType:银行流水号类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCBankSerialType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCSerialType:流水号类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCSerialType"] = "int" + +#////////////////////////////////////////////////////////////////////// +#DFITCBankAccountType:银行账户类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCBankAccountType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCFutureSerialType:期货公司流水号类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCFutureSerialType"] = "int" + +#////////////////////////////////////////////////////////////////////// +#DFITCDigestType:摘要类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCDigestType"] = "string" + +#////////////////////////////////////////////////////////////////////// +#DFITCBankAccTypeType是一个银行帐号类型类型 +#////////////////////////////////////////////////////////////////////// +#银行存折 +defineDict["DFITC_BAT_BankBook"] = '1' +#储蓄卡 +defineDict["DFITC_BAT_SavingCard"] = '2' +#信用卡 +defineDict["DFITC_BAT_CreditCard"] = '3' +typedefDict["DFITCBankAccTypeType"] = "char" + +#////////////////////////////////////////////////////////////////////// +#DFITCTransferStatusType:转账交易状态类型 +#////////////////////////////////////////////////////////////////////// +#正常 +defineDict["DFITC_TRFS_Normal"] = '0' +#被冲正 +defineDict["DFITC_TRFS_Repealed"] = '1' +typedefDict["DFITCTransferStatusType"] = "char" + +#////////////////////////////////////////////////////////////////////// +#DFITCTransferType:银期转账业务类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCTransferType"] = "int" + +#////////////////////////////////////////////////////////////////////// +#DFITCTransferType:银期转账处理结果类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCProcResultType"] = "int" +#成功 +defineDict["DFITC_PROC_SUCCESS"] = 0 +#失败 +defineDict["DFITC_PROC_FAIL"] = 1 +#等待回执 +defineDict["DFITC_PROC_WAIT_RTN"] = 2 + + +#////////////////////////////////////////////////////////////////////// +#DFITCApplyNumberType:银期转账申请号类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCApplyNumberType"] = "int" + + + +#////////////////////////////////////////////////////////////////////// +#DFITCImpliedVolatilityType:隐含波动率类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCImpliedVolatilityType"] = "float" + +#////////////////////////////////////////////////////////////////////// +#DFITCOptionComputationType:期权计算数据类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCOptionComputationType"] = "float" + +#///////////////////////////////////////////////////////// +#DFITCFunctionIDType:行情扩展功能号 +#///////////////////////////////////////////////////////// +typedefDict["DFITCFunctionIDType"] = "string" + +#///////////////////////////////////////////////////////// +#DFITCExtMarketDataType:行情扩展功能号 +#///////////////////////////////////////////////////////// +typedefDict["DFITCExtMarketDataType"] = "string" + + + +#////////////////////////////////////////////////////////////////////// +#DFITCExchangeStatusType:交易所状态数据类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCExchangeStatusType"] = "int" +#开盘前 +defineDict["DFITC_IS_BEFORETRADING"] = 0 +#非交易 +defineDict["DFITC_IS_NOTRADING"] = 1 +#连续交易 +defineDict["DFITC_IS_CONTINOUS"] = 2 +#集合竞价报单 +defineDict["DFITC_IS_AUCTIONORDERING"] = 3 +#集合竞价价格平衡 +defineDict["DFITC_IS_AUCTIONBALANCE"] = 4 +#集合竞价撮合 +defineDict["DFITC_IS_AUCTIONMATCH"] = 5 +#收盘 +defineDict["DFITC_IS_CLOSED"] = 6 + + +#////////////////////////////////////////////////////////////////////// +#DFITCPositionDateType:持仓日期类型 +#////////////////////////////////////////////////////////////////////// +typedefDict["DFITCPositionDateType"] = "int" +defineDict["DFITC_PSD_TODAY"] = 1 +defineDict["DFITC_PSD_HISTORY"] = 2 + + diff --git a/vn.trader/xspeedGateway/xspeedGateway.py b/vn.trader/xspeedGateway/xspeedGateway.py new file mode 100644 index 00000000..13434d37 --- /dev/null +++ b/vn.trader/xspeedGateway/xspeedGateway.py @@ -0,0 +1,1116 @@ +# encoding: UTF-8 + +''' +vn.xspeed的gateway接入 +''' + +import os +import json +from copy import copy + +from vnxspeedmd import MdApi +from vnxspeedtd import TdApi +from xspeedDataType import * +from vtGateway import * + +# 以下为一些VT类型和XSPEED类型的映射字典 +# 价格类型映射 +priceTypeMap = {} +priceTypeMap[PRICETYPE_LIMITPRICE] = defineDict["DFITC_LIMITORDER"] +priceTypeMap[PRICETYPE_MARKETPRICE] = defineDict["DFITC_MKORDER"] +priceTypeMapReverse = {v: k for k, v in priceTypeMap.items()} + +# 方向类型映射 +directionMap = {} +directionMap[DIRECTION_LONG] = defineDict['DFITC_SPD_BUY'] +directionMap[DIRECTION_SHORT] = defineDict['DFITC_SPD_SELL'] +directionMapReverse = {v: k for k, v in directionMap.items()} + +# 开平类型映射 +offsetMap = {} +offsetMap[OFFSET_OPEN] = defineDict['DFITC_SPD_OPEN'] +offsetMap[OFFSET_CLOSE] = defineDict['DFITC_SPD_CLOSE'] +offsetMap[OFFSET_CLOSETODAY] = defineDict['DFITC_SPD_CLOSETODAY'] +offsetMap[OFFSET_CLOSEYESTERDAY] = defineDict['DFITC_SPD_CLOSE'] +offsetMapReverse = {v:k for k,v in offsetMap.items()} + +# 交易所类型映射 +exchangeMap = {} +exchangeMap[EXCHANGE_CFFEX] = defineDict['DFITC_EXCHANGE_CFFEX'] +exchangeMap[EXCHANGE_SHFE] = defineDict['DFITC_EXCHANGE_SHFE'] +exchangeMap[EXCHANGE_CZCE] = defineDict['DFITC_EXCHANGE_CZCE'] +exchangeMap[EXCHANGE_DCE] = defineDict['DFITC_EXCHANGE_DCE'] +exchangeMap[EXCHANGE_UNKNOWN] = '' +exchangeMapReverse = {v:k for k,v in exchangeMap.items()} + +# 委托状态类型映射 +orderStatusMap = {} +orderStatusMap[STATUS_ALLTRADED] = defineDict["DFITC_SPD_FILLED"] +orderStatusMap[STATUS_PARTTRADED] = defineDict["DFITC_SPD_PARTIAL"] +orderStatusMap[STATUS_NOTTRADED] = defineDict["DFITC_SPD_IN_QUEUE"] +orderStatusMap[STATUS_CANCELLED] = defineDict["DFITC_SPD_CANCELED"] +orderStatusMapReverse = {v:k for k,v in orderStatusMap.items()} + + +######################################################################## +class XspeedGateway(VtGateway): + """XSPEED接口""" + + #---------------------------------------------------------------------- + def __init__(self, eventEngine, gatewayName='XSPEED'): + """Constructor""" + super(XspeedGateway, self).__init__(eventEngine, gatewayName) + + self.mdApi = XspeedMdApi(self) # 行情API + self.tdApi = XspeedTdApi(self) # 交易API + + self.mdConnected = False # 行情API连接状态,登录完成后为True + self.tdConnected = False # 交易API连接状态 + + self.qryEnabled = False # 是否要启动循环查询 + + #---------------------------------------------------------------------- + def connect(self): + """连接""" + # 载入json文件 + fileName = self.gatewayName + '_connect.json' + fileName = os.getcwd() + '\\xspeedGateway\\' + fileName + + try: + f = file(fileName) + except IOError: + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'读取连接配置出错,请检查' + self.onLog(log) + return + + # 解析json文件 + setting = json.load(f) + try: + accountID = str(setting['accountID']) + password = str(setting['password']) + tdAddress = str(setting['tdAddress']) + mdAddress = str(setting['mdAddress']) + except KeyError: + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'连接配置缺少字段,请检查' + self.onLog(log) + return + + # 创建行情和交易接口对象 + self.mdApi.connect(accountID, password, mdAddress) + self.tdApi.connect(accountID, password, tdAddress) + + # 初始化并启动查询 + self.initQuery() + + #---------------------------------------------------------------------- + def subscribe(self, subscribeReq): + """订阅行情""" + self.mdApi.subscribe(subscribeReq) + + #---------------------------------------------------------------------- + def sendOrder(self, orderReq): + """发单""" + return self.tdApi.sendOrder(orderReq) + + #---------------------------------------------------------------------- + def cancelOrder(self, cancelOrderReq): + """撤单""" + self.tdApi.cancelOrder(cancelOrderReq) + + #---------------------------------------------------------------------- + def qryAccount(self): + """查询账户资金""" + self.tdApi.qryAccount() + + #---------------------------------------------------------------------- + def qryPosition(self): + """查询持仓""" + self.tdApi.qryPosition() + + #---------------------------------------------------------------------- + def close(self): + """关闭""" + if self.mdConnected: + self.mdApi.close() + if self.tdConnected: + self.tdApi.close() + + #---------------------------------------------------------------------- + def initQuery(self): + """初始化连续查询""" + if self.qryEnabled: + # 需要循环的查询函数列表 + self.qryFunctionList = [self.qryAccount, self.qryPosition] + + self.qryCount = 0 # 查询触发倒计时 + self.qryTrigger = 2 # 查询触发点 + self.qryNextFunction = 0 # 上次运行的查询函数索引 + + self.startQuery() + + #---------------------------------------------------------------------- + def query(self, event): + """注册到事件处理引擎上的查询函数""" + self.qryCount += 1 + + if self.qryCount > self.qryTrigger: + # 清空倒计时 + self.qryCount = 0 + + # 执行查询函数 + function = self.qryFunctionList[self.qryNextFunction] + function() + + # 计算下次查询函数的索引,如果超过了列表长度,则重新设为0 + self.qryNextFunction += 1 + if self.qryNextFunction == len(self.qryFunctionList): + self.qryNextFunction = 0 + + #---------------------------------------------------------------------- + def startQuery(self): + """启动连续查询""" + self.eventEngine.register(EVENT_TIMER, self.query) + + #---------------------------------------------------------------------- + def setQryEnabled(self, qryEnabled): + """设置是否要启动循环查询""" + self.qryEnabled = qryEnabled + + +######################################################################## +class XspeedMdApi(MdApi): + """XSPEED行情API实现""" + + #---------------------------------------------------------------------- + def __init__(self, gateway): + """Constructor""" + super(XspeedMdApi, self).__init__() + + self.gateway = gateway # gateway对象 + self.gatewayName = gateway.gatewayName # gateway对象名称 + + self.reqID = EMPTY_INT # 操作请求编号 + + self.connectionStatus = False # 连接状态 + self.loginStatus = False # 登录状态 + + self.subscribedSymbols = set() # 已订阅合约代码 + + self.accountID = EMPTY_STRING # 账号 + self.password = EMPTY_STRING # 密码 + self.address = EMPTY_STRING # 服务器地址 + + #---------------------------------------------------------------------- + def connect(self, accountID, password, address): + """初始化连接""" + self.accountID = accountID # 账号 + self.password = password # 密码 + self.address = address # 服务器地址 + + # 如果尚未建立服务器连接,则进行连接 + if not self.connectionStatus: + self.createDFITCMdApi() + + # 初始化连接,成功会调用onFrontConnected + self.init(self.address) + + # 若已经连接但尚未登录,则进行登录 + else: + if not self.loginStatus: + self.login() + + #---------------------------------------------------------------------- + def subscribe(self, subscribeReq): + """订阅合约""" + # 这里的设计是,如果尚未登录就调用了订阅方法 + # 则先保存订阅请求,登录完成后会自动订阅 + if self.loginStatus: + self.reqID += 1 + self.subscribeMarketData(str(subscribeReq.symbol), self.reqID) + + self.subscribedSymbols.add(subscribeReq) + + #---------------------------------------------------------------------- + def login(self): + """登录""" + # 如果填入了用户名密码等,则登录 + if self.accountID and self.password: + self.reqID += 1 + req = {} + req['accountID'] = self.accountID + req['passwd'] = self.password + req['lRequestID'] = self.reqID + self.reqUserLogin(req) + + #---------------------------------------------------------------------- + def close(self): + """关闭""" + self.exit() + + #---------------------------------------------------------------------- + def onFrontConnected(self): + """服务器连接""" + self.connectionStatus = True + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'行情服务器连接成功' + self.gateway.onLog(log) + self.login() + + #---------------------------------------------------------------------- + def onFrontDisconnected(self, i): + """服务器断开""" + self.connectionStatus = False + self.loginStatus = False + self.gateway.mdConnected = False + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'行情服务器连接断开' + self.gateway.onLog(log) + + #---------------------------------------------------------------------- + def onRspUserLogin(self, data, error) : + """登陆回报""" + # 如果登录成功,推送日志信息 + if error['nErrorID'] == 0: + self.loginStatus = True + self.gateway.mdConnected = True + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'行情服务器登录完成' + self.gateway.onLog(log) + + # 重新订阅之前订阅的合约 + for subscribeReq in self.subscribedSymbols: + self.subscribe(subscribeReq) + + # 否则,推送错误信息 + else: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspUserLogout(self, data, error) : + """登出回报""" + # 如果登出成功,推送日志信息 + if error['nErrorID'] == 0: + self.loginStatus = False + self.gateway.tdConnected = False + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'行情服务器登出完成' + self.gateway.onLog(log) + + # 否则,推送错误信息 + else: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspError(self, error) : + """错误回报""" + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspSubMarketData(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspUnSubMarketData(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspSubForQuoteRsp(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspUnSubForQuoteRsp(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onMarketData(self, data) : + """行情推送""" + tick = VtTickData() + tick.gatewayName = self.gatewayName + + tick.symbol = data['instrumentID'] + tick.exchange = exchangeMapReverse.get(data['exchangeID'], u'未知') + tick.vtSymbol = tick.symbol #'.'.join([tick.symbol, EXCHANGE_UNKNOWN]) + + tick.lastPrice = data['lastPrice'] + tick.volume = data['Volume'] + tick.openInterest = data['openInterest'] + tick.time = '.'.join([data['UpdateTime'], str(data['UpdateMillisec']/100)]) + tick.date = data['tradingDay'] + + tick.openPrice = data['openPrice'] + tick.highPrice = data['highestPrice'] + tick.lowPrice = data['lowestPrice'] + tick.preClosePrice = data['preClosePrice'] + + tick.upperLimit = data['upperLimitPrice'] + tick.lowerLimit = data['lowerLimitPrice'] + + tick.bidPrice1 = data['BidPrice1'] + tick.bidVolume1 = data['BidVolume1'] + tick.askPrice1 = data['AskPrice1'] + tick.askVolume1 = data['AskVolume1'] + + self.gateway.onTick(tick) + + #---------------------------------------------------------------------- + def onCustomMarketData(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnForQuoteRsp(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspTradingDay(self, data) : + """""" + pass + + +######################################################################## +class XspeedTdApi(TdApi): + """XSPEED交易API实现""" + + #---------------------------------------------------------------------- + def __init__(self, gateway): + """API对象的初始化函数""" + super(XspeedTdApi, self).__init__() + + self.gateway = gateway # gateway对象 + self.gatewayName = gateway.gatewayName # gateway对象名称 + + self.reqID = EMPTY_INT # 操作请求编号 + self.localID = EMPTY_INT # 订单编号 + + self.connectionStatus = False # 连接状态 + self.loginStatus = False # 登录状态 + + self.accountID = EMPTY_STRING # 账号 + self.password = EMPTY_STRING # 密码 + self.address = EMPTY_STRING # 服务器地址 + + self.sessionID = EMPTY_INT # 会话编号 + + self.posDict = {} # 缓存持仓数据的字典 + self.orderDict = {} # 缓存委托数据的字典 + + #---------------------------------------------------------------------- + def connect(self, accountID, password, address): + """初始化连接""" + self.accountID = accountID # 账号 + self.password = password # 密码 + self.address = address # 服务器地址 + + # 如果尚未建立服务器连接,则进行连接 + if not self.connectionStatus: + self.createDFITCTraderApi() + + # 初始化连接,成功会调用onFrontConnected + self.init(self.address) + + # 若已经连接但尚未登录,则进行登录 + else: + if not self.loginStatus: + self.login() + + #---------------------------------------------------------------------- + def login(self): + """连接服务器""" + # 如果填入了用户名密码等,则登录 + if self.accountID and self.password: + self.reqID += 1 + req = {} + req['accountID'] = self.accountID + req['passwd'] = self.password + req['lRequestID'] = self.reqID + self.reqUserLogin(req) + + #---------------------------------------------------------------------- + def qryAccount(self): + """查询账户""" + self.reqID += 1 + req = {} + req['lRequestID'] = self.reqID + req['accountID'] = self.accountID + self.reqQryCustomerCapital(req) + + #---------------------------------------------------------------------- + def qryPosition(self): + """查询持仓""" + self.reqID += 1 + req = {} + req['lRequestID'] = self.reqID + req['accountID'] = self.accountID + self.reqQryPosition(req) + + #---------------------------------------------------------------------- + def sendOrder(self, orderReq): + """发单""" + self.reqID += 1 + self.localID += 1 + + req = {} + req['instrumentID'] = orderReq.symbol + req['insertPrice'] = orderReq.price + req['orderAmount'] = orderReq.volume + + # 下面如果由于传入的类型本接口不支持,则会返回空字符串 + try: + req['orderType'] = priceTypeMap[orderReq.priceType] + req['buySellType'] = directionMap[orderReq.direction] + req['openCloseType'] = offsetMap[orderReq.offset] + except KeyError: + return '' + + req['localOrderID'] = self.localID + req['accountID'] = self.accountID + req['speculator'] = defineDict['DFITC_SPD_SPECULATOR'] # 投机单 + req['minMatchAmount'] = 1 # 最小成交量为1 + req['lRequestID'] = self.reqID + + self.reqInsertOrder(req) + + # 返回订单号(字符串),便于某些算法进行动态管理 + vtOrderID = '.'.join([self.gatewayName, str(self.localID)]) + return vtOrderID + + #---------------------------------------------------------------------- + def cancelOrder(self, cancelOrderReq): + """撤单""" + self.reqID += 1 + + req = {} + req['instrumentID'] = cancelOrderReq.symbol + req['localOrderID'] = int(cancelOrderReq.orderID) + req['accountID'] = self.accountID + req['lRequestID'] = self.reqID + + self.reqOrderAction(req, self.reqID) + + #---------------------------------------------------------------------- + def close(self): + """关闭""" + self.exit() + + #---------------------------------------------------------------------- + def onFrontConnected(self): + """服务器连接""" + self.connectionStatus = True + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'交易服务器连接成功' + self.gateway.onLog(log) + + self.login() + + #---------------------------------------------------------------------- + def onFrontDisconnected(self, i): + """服务器断开""" + self.connectionStatus = False + self.loginStatus = False + self.gateway.tdConnected = False + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'交易服务器连接断开' + self.gateway.onLog(log) + + #---------------------------------------------------------------------- + def onRspUserLogin(self, data, error) : + """登陆回报""" + # 如果登录成功,推送日志信息 + if error['nErrorID'] == 0: + self.sessionID = data['sessionID'] + + self.loginStatus = True + self.gateway.tdConnected = True + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'交易服务器登录完成' + self.gateway.onLog(log) + + # 查询合约代码 + self.reqID += 1 + req = {} + req['lRequestID'] = self.reqID + self.reqQryExchangeInstrument(req) + + # 否则,推送错误信息 + else: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspUserLogout(self, data, error) : + """登出回报""" + # 如果登出成功,推送日志信息 + if error['nErrorID'] == 0: + self.loginStatus = False + self.gateway.tdConnected = False + + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'交易服务器登出完成' + self.gateway.onLog(log) + + # 否则,推送错误信息 + else: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspInsertOrder(self, data, error) : + """发单错误(柜台)""" + if error['nErrorID']: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRspCancelOrder(self, data, error) : + """撤单错误(柜台)""" + if error['nErrorID']: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRtnErrorMsg(self, error) : + """错误回报""" + if error['nErrorID']: + err = VtErrorData() + err.gatewayName = self.gatewayName + err.errorID = error['nErrorID'] + err.errorMsg = error['errorMsg'].decode('gbk') + self.gateway.onError(err) + + #---------------------------------------------------------------------- + def onRtnMatchedInfo(self, data) : + """成交回报""" + # 更新成交信息 + trade = VtTradeData() + trade.gatewayName = self.gatewayName + + # 保存代码和报单号 + trade.symbol = data['instrumentID'] + trade.exchange = exchangeMapReverse.get(data['exchangeID'], EXCHANGE_UNKNOWN) + trade.vtSymbol = trade.symbol + + trade.tradeID = data['matchID'] + trade.vtTradeID = '.'.join([self.gatewayName, trade.tradeID]) + + trade.orderID = str(data['localOrderID']) + trade.vtOrderID = '.'.join([self.gatewayName, trade.orderID]) + + trade.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + trade.offset = offsetMapReverse.get(data['openCloseType'], OFFSET_UNKNOWN) + + trade.price = data['insertPrice'] + trade.volume = data['matchedAmount'] + trade.tradeTime = data['matchedTime'] + + # 推送 + self.gateway.onTrade(trade) + + + # 更新委托信息 + # 创建报单数据对象 + order = VtOrderData() + order.gatewayName = self.gatewayName + + # 保存代码和报单号 + order.symbol = data['instrumentID'] + order.exchange = exchangeMapReverse[data['exchangeID']] + order.vtSymbol = order.symbol + order.orderID = str(data['localOrderID']) + order.vtOrderID = '.'.join([self.gatewayName, order.orderID]) + + order.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + order.offset = offsetMapReverse.get(data['openCloseType'], OFFSET_UNKNOWN) + order.status = orderStatusMapReverse.get(data['orderStatus'], STATUS_UNKNOWN) + + order.price = data['insertPrice'] + order.totalVolume = data['orderAmount'] + + # 推送 + self.gateway.onOrder(order) + + #---------------------------------------------------------------------- + def onRtnOrder(self, data) : + """报单回报""" + # 更新最大报单编号 + newLocalID = data['localOrderID'] + self.localID = max(self.localID, newLocalID) + + # 获取报单数据对象 + if newLocalID in self.orderDict: + order = self.orderDict[newLocalID] + else: + order = VtOrderData() + order.gatewayName = self.gatewayName + + # 保存后续不会变化的数据 + order.symbol = data['instrumentID'] + order.exchange = exchangeMapReverse[data['exchangeID']] + order.vtSymbol = order.symbol + + order.orderID = str(newLocalID) + order.vtOrderID = '.'.join([self.gatewayName, order.orderID]) + + order.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + order.offset = offsetMapReverse.get(data['openCloseType'], OFFSET_UNKNOWN) + + # 价格、报单量等数值 + order.price = data['insertPrice'] + order.totalVolume = data['orderAmount'] + order.sessionID = data['sessionID'] + + order.status = orderStatusMapReverse.get(data['orderStatus'], STATUS_UNKNOWN) + + # 推送 + self.gateway.onOrder(copy(order)) + + #---------------------------------------------------------------------- + def onRtnCancelOrder(self, data) : + """撤单推送""" + # 更新最大报单编号 + newLocalID = data['localOrderID'] + self.localID = max(self.localID, int(newLocalID)) + + # 获取报单数据对象 + if newLocalID in self.orderDict: + order = self.orderDict[newLocalID] + else: + order = VtOrderData() + order.gatewayName = self.gatewayName + + # 保存后续不会变化的数据 + order.symbol = data['instrumentID'] + order.exchange = exchangeMapReverse[data['exchangeID']] + order.vtSymbol = order.symbol + + order.orderID = str(newLocalID) + order.vtOrderID = '.'.join([self.gatewayName, order.orderID]) + + order.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + order.offset = offsetMapReverse.get(data['openCloseType'], OFFSET_UNKNOWN) + + # 价格、报单量等数值 + order.price = data['insertPrice'] + order.totalVolume = data['orderAmount'] + order.sessionID = data['sessionID'] + + order.status = orderStatusMapReverse.get(data['orderStatus'], STATUS_UNKNOWN) + order.cancelTime = data['canceledTime'] + + # 推送 + self.gateway.onOrder(copy(order)) + + #---------------------------------------------------------------------- + def onRspQryOrderInfo(self, data, error, last) : + """查询委托回报""" + if not data['localOrderID']: + return + + # 更新最大报单编号 + newLocalID = data['localOrderID'] + self.localID = max(self.localID, int(newLocalID)) + + # 获取报单数据对象 + if newLocalID in self.orderDict: + order = self.orderDict[newLocalID] + else: + order = VtOrderData() + order.gatewayName = self.gatewayName + + # 保存后续不会变化的数据 + order.symbol = data['instrumentID'] + order.exchange = exchangeMapReverse[data['exchangeID']] + order.vtSymbol = order.symbol + + order.orderID = str(newLocalID) + order.vtOrderID = '.'.join([self.gatewayName, order.orderID]) + + order.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + order.offset = offsetMapReverse.get(data['openCloseType'], OFFSET_UNKNOWN) + + order.price = data['insertPrice'] + order.totalVolume = data['orderAmount'] + order.sessionID = data['sessionID'] + + order.status = orderStatusMapReverse.get(data['orderStatus'], STATUS_UNKNOWN) + order.tradedVolume = data['matchedAmount'] + order.orderTime = data['commTime'] + + # 推送 + self.gateway.onOrder(copy(order)) + + if last: + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'查询委托完成' + self.gateway.onLog(log) + + #---------------------------------------------------------------------- + def onRspQryMatchInfo(self, data, error, last) : + """""" + # 创建报单数据对象 + trade = VtTradeData() + trade.gatewayName = self.gatewayName + + # 保存代码和报单号 + trade.symbol = data['instrumentID'] + trade.exchange = exchangeMapReverse.get(data['exchangeID'], EXCHANGE_UNKNOWN) + trade.vtSymbol = trade.symbol #'.'.join([trade.symbol, trade.exchange]) + + trade.tradeID = data['matchedID'] + trade.vtTradeID = '.'.join([self.gatewayName, trade.tradeID]) + + trade.orderID = str(data['localOrderID']) + trade.vtOrderID = '.'.join([self.gatewayName, trade.orderID]) + + # 方向 + trade.direction = directionMapReverse.get(data['buySellType'], DIRECTION_UNKNOWN) + + # 开平 + trade.offset = offsetMapReverse.get(data['openClose'], OFFSET_UNKNOWN) + + # 价格、报单量等数值 + trade.price = data['matchedPrice'] + trade.volume = data['matchedAmount'] + trade.tradeTime = data['matchedTime'] + + # 推送 + self.gateway.onTrade(trade) + + if last: + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'查询成交完成' + self.gateway.onLog(log) + + #---------------------------------------------------------------------- + def onRspQryPosition(self, data, error, last) : + """持仓查询回报""" + # 获取缓存字典中的持仓对象,若无则创建并初始化 + positionName = '.'.join([data['instrumentID'], str(data['buySellType'])]) + + if positionName in self.posDict: + pos = self.posDict[positionName] + else: + pos = VtPositionData() + self.posDict[positionName] = pos + + pos.gatewayName = self.gatewayName + + # 保存代码 + pos.symbol = data['instrumentID'] + pos.vtSymbol = pos.symbol # 这里因为data中没有ExchangeID这个字段 + + # 方向 + pos.direction = directionMapReverse.get(data['buySellType'], '') + + # VT系统持仓名 + pos.vtPositionName = '.'.join([pos.vtSymbol, pos.direction]) + + # 持仓量 + if data['positionAmount']: + pos.position = data['positionAmount'] + + if data['lastAmount']: + pos.ydPosition = data['lastAmount'] + + # 持仓均价 + pos.price = data['positionAvgPrice'] + + # 推送 + newpos = copy(pos) + self.gateway.onPosition(newpos) + + #---------------------------------------------------------------------- + def onRspCustomerCapital(self, data, error, last) : + """资金账户查询回报""" + account = VtAccountData() + account.gatewayName = self.gatewayName + + # 账户代码 + account.accountID = data['accountID'] + account.vtAccountID = '.'.join([self.gatewayName, account.accountID]) + + # 数值相关 + account.preBalance = data['preEquity'] + account.available = data['available'] + account.commission = data['fee'] + account.margin = data['margin'] + account.closeProfit = data['closeProfitLoss'] + account.positionProfit = data['positionProfitLoss'] + account.balance = data['todayEquity'] + + # 推送 + self.gateway.onAccount(account) + + #---------------------------------------------------------------------- + def onRspQryExchangeInstrument(self, data, error, last) : + """合约查询回报""" + contract = VtContractData() + contract.gatewayName = self.gatewayName + + contract.symbol = data['instrumentID'] + contract.exchange = exchangeMapReverse.get(data['exchangeID'], EXCHANGE_UNKNOWN) + contract.vtSymbol = contract.symbol #'.'.join([contract.symbol, contract.exchange]) + contract.name = data['VarietyName'].decode('GBK') + contract.symbol + + # 合约数值 + contract.size = data['contractMultiplier'] + contract.priceTick = data['minPriceFluctuation'] + contract.strikePrice = data['strikePrice'] + contract.underlyingSymbol = data['underlying'] + + # 合约类型 + if data['instrumentType'] == 0: + contract.productClass = PRODUCT_FUTURES + elif data['instrumentType'] == 1: + contract.productClass = PRODUCT_OPTION + else: + contract.productClass = PRODUCT_UNKNOWN + + # 期权类型 + if data['optionType'] == 1: + contract.optionType = OPTION_CALL + elif data['optionType'] == 2: + contract.optionType = OPTION_PUT + + # 推送 + self.gateway.onContract(contract) + + if last: + log = VtLogData() + log.gatewayName = self.gatewayName + log.logContent = u'交易合约信息获取完成' + self.gateway.onLog(log) + + # 查询委托 + self.reqID += 1 + req = {} + req['lRequestID'] = self.reqID + req['accountID'] = self.accountID + self.reqQryOrderInfo(req) + + # 查询成交 + self.reqID += 1 + req = {} + req['lRequestID'] = self.reqID + req['accountID'] = self.accountID + self.reqQryMatchInfo(req) + + #---------------------------------------------------------------------- + def onRspArbitrageInstrument(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQrySpecifyInstrument(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryPositionDetail(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnTradingNotice(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspResetPassword(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onnRspQryTradeCode(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspBillConfirm(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onnRspEquityComputMode(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryBill(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspConfirmProductInfo(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspTradingDay(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQuoteInsert(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnQuoteInsert(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQuoteCancel(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnQuoteCancel(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnQuoteMatchedInfo(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspCancelAllOrder(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryQuoteNotice(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspForQuote(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnForQuote(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryQuoteOrderInfo(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryForQuote(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryTransferBank(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryTransferSerial(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspFromBankToFutureByFuture(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspFromFutureToBankByFuture(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnFromBankToFutureByFuture(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnFromFutureToBankByFuture(self, data, error) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnRepealFromFutureToBankByBank(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryExchangeStatus(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRtnExchangeStatus(self, data) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryDepthMarketData(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspQryTradeCode(self, data, error, last) : + """""" + pass + + #---------------------------------------------------------------------- + def onRspEquityComputMode(self, data) : + """""" + pass + \ No newline at end of file diff --git a/vn.xspeed/pyscript/generate_td_functions.py b/vn.xspeed/pyscript/generate_td_functions.py index d9c0f5d9..a73f93e6 100644 --- a/vn.xspeed/pyscript/generate_td_functions.py +++ b/vn.xspeed/pyscript/generate_td_functions.py @@ -72,6 +72,9 @@ def createWrap(cbName): if 'OnRspError' in cbName: on_line = 'virtual void on' + cbName[2:] + '(dict error)\n' override_line = '("on' + cbName[2:] + '")(error);\n' + elif 'OnRspQry' in cbName: + on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error, bool last)\n' + override_line = '("on' + cbName[2:] + '")(data, error, last);\n' elif 'OnRsp' in cbName: on_line = 'virtual void on' + cbName[2:] + '(dict data, dict error)\n' override_line = '("on' + cbName[2:] + '")(data, error);\n' @@ -259,7 +262,8 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList): line = '\tgetLong(req, "' + key + '", &myreq.' + key + ');\n' elif value == 'short': line = '\tgetShort(req, "' + key + '", &myreq.' + key + ');\n' - elif value == 'double': + elif value == 'float': + print line line = '\tgetDouble(req, "' + key + '", &myreq.' + key + ');\n' ffunction.write(line) @@ -305,4 +309,6 @@ fdefine.close() fheaderprocess.close() fheaderon.close() fheaderfunction.close() -fwrap.close() \ No newline at end of file +fwrap.close() + +input() \ No newline at end of file diff --git a/vn.xspeed/pyscript/xspeed_struct.pyc b/vn.xspeed/pyscript/xspeed_struct.pyc index ea006918..95d814ec 100644 Binary files a/vn.xspeed/pyscript/xspeed_struct.pyc and b/vn.xspeed/pyscript/xspeed_struct.pyc differ diff --git a/vn.xspeed/pyscript/xspeed_td_function.cpp b/vn.xspeed/pyscript/xspeed_td_function.cpp index 4351302b..68a43eac 100644 --- a/vn.xspeed/pyscript/xspeed_td_function.cpp +++ b/vn.xspeed/pyscript/xspeed_td_function.cpp @@ -28,7 +28,7 @@ int TdApi::reqInsertOrder(dict req) getString(req, "instrumentID", myreq.instrumentID); getInt(req, "openCloseType", &myreq.openCloseType); getLong(req, "localOrderID", &myreq.localOrderID); - getLong(req, "localOrderID", &myreq.localOrderID); + getDouble(req, "insertPrice", &myreq.insertPrice); getChar(req, "orderProperty", myreq.orderProperty); getShort(req, "buySellType", &myreq.buySellType); getInt(req, "orderType", &myreq.orderType); @@ -38,7 +38,7 @@ int TdApi::reqInsertOrder(dict req) getInt(req, "reservedType2", &myreq.reservedType2); getInt(req, "insertType", &myreq.insertType); getLong(req, "orderAmount", &myreq.orderAmount); - getLong(req, "orderAmount", &myreq.orderAmount); + getDouble(req, "profitLossPrice", &myreq.profitLossPrice); getString(req, "customCategory", myreq.customCategory); getInt(req, "instrumentType", &myreq.instrumentType); getString(req, "accountID", myreq.accountID); @@ -247,7 +247,7 @@ int TdApi::reqQuoteInsert(dict req) getString(req, "quoteID", myreq.quoteID); getInt(req, "sOpenCloseType", &myreq.sOpenCloseType); getLong(req, "bOrderAmount", &myreq.bOrderAmount); - getLong(req, "bOrderAmount", &myreq.bOrderAmount); + getDouble(req, "sInsertPrice", &myreq.sInsertPrice); getLong(req, "lRequestID", &myreq.lRequestID); getInt(req, "insertType", &myreq.insertType); getLong(req, "sOrderAmount", &myreq.sOrderAmount); @@ -255,7 +255,7 @@ int TdApi::reqQuoteInsert(dict req) getLong(req, "localOrderID", &myreq.localOrderID); getInt(req, "bSpeculator", &myreq.bSpeculator); getString(req, "customCategory", myreq.customCategory); - getString(req, "customCategory", myreq.customCategory); + getDouble(req, "bInsertPrice", &myreq.bInsertPrice); getInt(req, "instrumentType", &myreq.instrumentType); getString(req, "accountID", myreq.accountID); int i = this->api->ReqQuoteInsert(&myreq); @@ -357,7 +357,7 @@ int TdApi::reqFromBankToFutureByFuture(dict req) getLong(req, "lRequestID", &myreq.lRequestID); getString(req, "bankID", myreq.bankID); getString(req, "password", myreq.password); - getString(req, "password", myreq.password); + getDouble(req, "tradeAmount", &myreq.tradeAmount); getString(req, "accountID", myreq.accountID); int i = this->api->ReqFromBankToFutureByFuture(&myreq); return i; @@ -373,7 +373,7 @@ int TdApi::reqFromFutureToBankByFuture(dict req) getLong(req, "lRequestID", &myreq.lRequestID); getString(req, "bankID", myreq.bankID); getString(req, "password", myreq.password); - getString(req, "password", myreq.password); + getDouble(req, "tradeAmount", &myreq.tradeAmount); getString(req, "accountID", myreq.accountID); int i = this->api->ReqFromFutureToBankByFuture(&myreq); return i; diff --git a/vn.xspeed/pyscript/xspeed_td_wrap.cpp b/vn.xspeed/pyscript/xspeed_td_wrap.cpp index 7bdb2c9f..9f1f04e6 100644 --- a/vn.xspeed/pyscript/xspeed_td_wrap.cpp +++ b/vn.xspeed/pyscript/xspeed_td_wrap.cpp @@ -94,11 +94,11 @@ virtual void onRtnCancelOrder(dict data) } }; -virtual void onRspQryOrderInfo(dict data, dict error) +virtual void onRspQryOrderInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryOrderInfo")(data, error); + this->get_override("onRspQryOrderInfo")(data, error, last); } catch (error_already_set const &) { @@ -106,11 +106,11 @@ virtual void onRspQryOrderInfo(dict data, dict error) } }; -virtual void onRspQryMatchInfo(dict data, dict error) +virtual void onRspQryMatchInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryMatchInfo")(data, error); + this->get_override("onRspQryMatchInfo")(data, error, last); } catch (error_already_set const &) { @@ -118,11 +118,11 @@ virtual void onRspQryMatchInfo(dict data, dict error) } }; -virtual void onRspQryPosition(dict data, dict error) +virtual void onRspQryPosition(dict data, dict error, bool last) { try { - this->get_override("onRspQryPosition")(data, error); + this->get_override("onRspQryPosition")(data, error, last); } catch (error_already_set const &) { @@ -142,11 +142,11 @@ virtual void onRspCustomerCapital(dict data, dict error) } }; -virtual void onRspQryExchangeInstrument(dict data, dict error) +virtual void onRspQryExchangeInstrument(dict data, dict error, bool last) { try { - this->get_override("onRspQryExchangeInstrument")(data, error); + this->get_override("onRspQryExchangeInstrument")(data, error, last); } catch (error_already_set const &) { @@ -166,11 +166,11 @@ virtual void onRspArbitrageInstrument(dict data, dict error) } }; -virtual void onRspQrySpecifyInstrument(dict data, dict error) +virtual void onRspQrySpecifyInstrument(dict data, dict error, bool last) { try { - this->get_override("onRspQrySpecifyInstrument")(data, error); + this->get_override("onRspQrySpecifyInstrument")(data, error, last); } catch (error_already_set const &) { @@ -178,11 +178,11 @@ virtual void onRspQrySpecifyInstrument(dict data, dict error) } }; -virtual void onRspQryPositionDetail(dict data, dict error) +virtual void onRspQryPositionDetail(dict data, dict error, bool last) { try { - this->get_override("onRspQryPositionDetail")(data, error); + this->get_override("onRspQryPositionDetail")(data, error, last); } catch (error_already_set const &) { @@ -214,11 +214,11 @@ virtual void onRspResetPassword(dict data, dict error) } }; -virtual void onRspQryTradeCode(dict data, dict error) +virtual void onRspQryTradeCode(dict data, dict error, bool last) { try { - this->get_override("onRspQryTradeCode")(data, error); + this->get_override("onRspQryTradeCode")(data, error, last); } catch (error_already_set const &) { @@ -250,11 +250,11 @@ virtual void onRspEquityComputMode(dict data, dict error) } }; -virtual void onRspQryBill(dict data, dict error) +virtual void onRspQryBill(dict data, dict error, bool last) { try { - this->get_override("onRspQryBill")(data, error); + this->get_override("onRspQryBill")(data, error, last); } catch (error_already_set const &) { @@ -358,11 +358,11 @@ virtual void onRspCancelAllOrder(dict data, dict error) } }; -virtual void onRspQryQuoteNotice(dict data, dict error) +virtual void onRspQryQuoteNotice(dict data, dict error, bool last) { try { - this->get_override("onRspQryQuoteNotice")(data, error); + this->get_override("onRspQryQuoteNotice")(data, error, last); } catch (error_already_set const &) { @@ -394,11 +394,11 @@ virtual void onRtnForQuote(dict data) } }; -virtual void onRspQryQuoteOrderInfo(dict data, dict error) +virtual void onRspQryQuoteOrderInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryQuoteOrderInfo")(data, error); + this->get_override("onRspQryQuoteOrderInfo")(data, error, last); } catch (error_already_set const &) { @@ -406,11 +406,11 @@ virtual void onRspQryQuoteOrderInfo(dict data, dict error) } }; -virtual void onRspQryForQuote(dict data, dict error) +virtual void onRspQryForQuote(dict data, dict error, bool last) { try { - this->get_override("onRspQryForQuote")(data, error); + this->get_override("onRspQryForQuote")(data, error, last); } catch (error_already_set const &) { @@ -418,11 +418,11 @@ virtual void onRspQryForQuote(dict data, dict error) } }; -virtual void onRspQryTransferBank(dict data, dict error) +virtual void onRspQryTransferBank(dict data, dict error, bool last) { try { - this->get_override("onRspQryTransferBank")(data, error); + this->get_override("onRspQryTransferBank")(data, error, last); } catch (error_already_set const &) { @@ -430,11 +430,11 @@ virtual void onRspQryTransferBank(dict data, dict error) } }; -virtual void onRspQryTransferSerial(dict data, dict error) +virtual void onRspQryTransferSerial(dict data, dict error, bool last) { try { - this->get_override("onRspQryTransferSerial")(data, error); + this->get_override("onRspQryTransferSerial")(data, error, last); } catch (error_already_set const &) { @@ -502,11 +502,11 @@ virtual void onRtnRepealFromFutureToBankByBank(dict data) } }; -virtual void onRspQryExchangeStatus(dict data, dict error) +virtual void onRspQryExchangeStatus(dict data, dict error, bool last) { try { - this->get_override("onRspQryExchangeStatus")(data, error); + this->get_override("onRspQryExchangeStatus")(data, error, last); } catch (error_already_set const &) { @@ -526,11 +526,11 @@ virtual void onRtnExchangeStatus(dict data) } }; -virtual void onRspQryDepthMarketData(dict data, dict error) +virtual void onRspQryDepthMarketData(dict data, dict error, bool last) { try { - this->get_override("onRspQryDepthMarketData")(data, error); + this->get_override("onRspQryDepthMarketData")(data, error, last); } catch (error_already_set const &) { diff --git a/vn.xspeed/test/vnxspeedtd.pyd b/vn.xspeed/test/vnxspeedtd.pyd index 078f7234..39eefaf6 100644 Binary files a/vn.xspeed/test/vnxspeedtd.pyd and b/vn.xspeed/test/vnxspeedtd.pyd differ diff --git a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.exp b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.exp index 62e1a648..cf017b9e 100644 Binary files a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.exp and b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.exp differ diff --git a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.lib b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.lib index 8f6cd9c8..49ca09e9 100644 Binary files a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.lib and b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.lib differ diff --git a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pdb b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pdb index aacd6db1..a2d8dc3a 100644 Binary files a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pdb and b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pdb differ diff --git a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pyd b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pyd index 078f7234..39eefaf6 100644 Binary files a/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pyd and b/vn.xspeed/vnxspeedtd/Release/vnxspeedtd.pyd differ diff --git a/vn.xspeed/vnxspeedtd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml b/vn.xspeed/vnxspeedtd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml new file mode 100644 index 00000000..0568c66a --- /dev/null +++ b/vn.xspeed/vnxspeedtd/Visual Studio 2013/settings/Windows Azure Subscriptions.xml @@ -0,0 +1,5 @@ + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAhE4p+D02F0WYPy8qCmMXxAAAAAACAAAAAAAQZgAAAAEAACAAAADdKqCExbfQ0qmV8fAhwxJ3ziOWd8i4kgHKWaahbmhZpwAAAAAOgAAAAAIAACAAAACIs6nje6UjzBQhCRlDYPyT/WvjZ7HWe6fwrCRtdSUF6hAAAABX62nkc+hjHXTxtgPsdkBcQAAAAOlZDGXW8lDNFQGhZ5pLW0aGiuUFyFCyt4EoRQh92KTtiXhOeaxEBfA6MbkxnzyJ4B/ZmwskriS/m0CTVTZFRUY= + \ No newline at end of file diff --git a/vn.xspeed/vnxspeedtd/vnxspeedtd.v12.suo b/vn.xspeed/vnxspeedtd/vnxspeedtd.v12.suo index 0bedf413..cabdc19b 100644 Binary files a/vn.xspeed/vnxspeedtd/vnxspeedtd.v12.suo and b/vn.xspeed/vnxspeedtd/vnxspeedtd.v12.suo differ diff --git a/vn.xspeed/vnxspeedtd/vnxspeedtd/vnxspeedtd.cpp b/vn.xspeed/vnxspeedtd/vnxspeedtd/vnxspeedtd.cpp index af454927..ee11d96c 100644 --- a/vn.xspeed/vnxspeedtd/vnxspeedtd/vnxspeedtd.cpp +++ b/vn.xspeed/vnxspeedtd/vnxspeedtd/vnxspeedtd.cpp @@ -2978,7 +2978,7 @@ int TdApi::reqInsertOrder(dict req) getString(req, "instrumentID", myreq.instrumentID); getInt(req, "openCloseType", &myreq.openCloseType); getLong(req, "localOrderID", &myreq.localOrderID); - getLong(req, "localOrderID", &myreq.localOrderID); + getDouble(req, "insertPrice", &myreq.insertPrice); getChar(req, "orderProperty", &myreq.orderProperty); getShort(req, "buySellType", &myreq.buySellType); getInt(req, "orderType", &myreq.orderType); @@ -2988,7 +2988,7 @@ int TdApi::reqInsertOrder(dict req) getInt(req, "reservedType2", &myreq.reservedType2); getInt(req, "insertType", &myreq.insertType); getLong(req, "orderAmount", &myreq.orderAmount); - getLong(req, "orderAmount", &myreq.orderAmount); + getDouble(req, "profitLossPrice", &myreq.profitLossPrice); getString(req, "customCategory", myreq.customCategory); getInt(req, "instrumentType", &myreq.instrumentType); getString(req, "accountID", myreq.accountID); @@ -3197,7 +3197,7 @@ int TdApi::reqQuoteInsert(dict req) getString(req, "quoteID", myreq.quoteID); getInt(req, "sOpenCloseType", &myreq.sOpenCloseType); getLong(req, "bOrderAmount", &myreq.bOrderAmount); - getLong(req, "bOrderAmount", &myreq.bOrderAmount); + getDouble(req, "sInsertPrice", &myreq.sInsertPrice); getLong(req, "lRequestID", &myreq.lRequestID); getInt(req, "insertType", &myreq.insertType); getLong(req, "sOrderAmount", &myreq.sOrderAmount); @@ -3205,7 +3205,7 @@ int TdApi::reqQuoteInsert(dict req) getLong(req, "localOrderID", &myreq.localOrderID); getInt(req, "bSpeculator", &myreq.bSpeculator); getString(req, "customCategory", myreq.customCategory); - getString(req, "customCategory", myreq.customCategory); + getDouble(req, "bInsertPrice", &myreq.bInsertPrice); getInt(req, "instrumentType", &myreq.instrumentType); getString(req, "accountID", myreq.accountID); int i = this->api->ReqQuoteInsert(&myreq); @@ -3307,7 +3307,7 @@ int TdApi::reqFromBankToFutureByFuture(dict req) getLong(req, "lRequestID", &myreq.lRequestID); getString(req, "bankID", myreq.bankID); getString(req, "password", myreq.password); - getString(req, "password", myreq.password); + getDouble(req, "tradeAmount", &myreq.tradeAmount); getString(req, "accountID", myreq.accountID); int i = this->api->ReqFromBankToFutureByFuture(&myreq); return i; @@ -3323,7 +3323,7 @@ int TdApi::reqFromFutureToBankByFuture(dict req) getLong(req, "lRequestID", &myreq.lRequestID); getString(req, "bankID", myreq.bankID); getString(req, "password", myreq.password); - getString(req, "password", myreq.password); + getDouble(req, "tradeAmount", &myreq.tradeAmount); getString(req, "accountID", myreq.accountID); int i = this->api->ReqFromFutureToBankByFuture(&myreq); return i; @@ -3351,7 +3351,6 @@ int TdApi::reqQryDepthMarketData(dict req) }; - ///------------------------------------------------------------------------------------- ///Boost.Pythonװ ///------------------------------------------------------------------------------------- @@ -3479,11 +3478,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryOrderInfo(dict data, dict error) + virtual void onRspQryOrderInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryOrderInfo")(data, error); + this->get_override("onRspQryOrderInfo")(data, error, last); } catch (error_already_set const &) { @@ -3491,11 +3490,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryMatchInfo(dict data, dict error) + virtual void onRspQryMatchInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryMatchInfo")(data, error); + this->get_override("onRspQryMatchInfo")(data, error, last); } catch (error_already_set const &) { @@ -3503,11 +3502,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryPosition(dict data, dict error) + virtual void onRspQryPosition(dict data, dict error, bool last) { try { - this->get_override("onRspQryPosition")(data, error); + this->get_override("onRspQryPosition")(data, error, last); } catch (error_already_set const &) { @@ -3515,11 +3514,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspCustomerCapital(dict data, dict error) + virtual void onRspCustomerCapital(dict data, dict error, bool last) { try { - this->get_override("onRspCustomerCapital")(data, error); + this->get_override("onRspCustomerCapital")(data, error, last); } catch (error_already_set const &) { @@ -3527,11 +3526,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryExchangeInstrument(dict data, dict error) + virtual void onRspQryExchangeInstrument(dict data, dict error, bool last) { try { - this->get_override("onRspQryExchangeInstrument")(data, error); + this->get_override("onRspQryExchangeInstrument")(data, error, last); } catch (error_already_set const &) { @@ -3551,11 +3550,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQrySpecifyInstrument(dict data, dict error) + virtual void onRspQrySpecifyInstrument(dict data, dict error, bool last) { try { - this->get_override("onRspQrySpecifyInstrument")(data, error); + this->get_override("onRspQrySpecifyInstrument")(data, error, last); } catch (error_already_set const &) { @@ -3563,11 +3562,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryPositionDetail(dict data, dict error) + virtual void onRspQryPositionDetail(dict data, dict error, bool last) { try { - this->get_override("onRspQryPositionDetail")(data, error); + this->get_override("onRspQryPositionDetail")(data, error, last); } catch (error_already_set const &) { @@ -3599,11 +3598,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryTradeCode(dict data, dict error) + virtual void onRspQryTradeCode(dict data, dict error, bool last) { try { - this->get_override("onRspQryTradeCode")(data, error); + this->get_override("onRspQryTradeCode")(data, error, last); } catch (error_already_set const &) { @@ -3635,11 +3634,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryBill(dict data, dict error) + virtual void onRspQryBill(dict data, dict error, bool last) { try { - this->get_override("onRspQryBill")(data, error); + this->get_override("onRspQryBill")(data, error, last); } catch (error_already_set const &) { @@ -3743,11 +3742,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryQuoteNotice(dict data, dict error) + virtual void onRspQryQuoteNotice(dict data, dict error, bool last) { try { - this->get_override("onRspQryQuoteNotice")(data, error); + this->get_override("onRspQryQuoteNotice")(data, error, last); } catch (error_already_set const &) { @@ -3779,11 +3778,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryQuoteOrderInfo(dict data, dict error) + virtual void onRspQryQuoteOrderInfo(dict data, dict error, bool last) { try { - this->get_override("onRspQryQuoteOrderInfo")(data, error); + this->get_override("onRspQryQuoteOrderInfo")(data, error, last); } catch (error_already_set const &) { @@ -3791,11 +3790,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryForQuote(dict data, dict error) + virtual void onRspQryForQuote(dict data, dict error, bool last) { try { - this->get_override("onRspQryForQuote")(data, error); + this->get_override("onRspQryForQuote")(data, error, last); } catch (error_already_set const &) { @@ -3803,11 +3802,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryTransferBank(dict data, dict error) + virtual void onRspQryTransferBank(dict data, dict error, bool last) { try { - this->get_override("onRspQryTransferBank")(data, error); + this->get_override("onRspQryTransferBank")(data, error, last); } catch (error_already_set const &) { @@ -3815,11 +3814,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryTransferSerial(dict data, dict error) + virtual void onRspQryTransferSerial(dict data, dict error, bool last) { try { - this->get_override("onRspQryTransferSerial")(data, error); + this->get_override("onRspQryTransferSerial")(data, error, last); } catch (error_already_set const &) { @@ -3887,11 +3886,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryExchangeStatus(dict data, dict error) + virtual void onRspQryExchangeStatus(dict data, dict error, bool last) { try { - this->get_override("onRspQryExchangeStatus")(data, error); + this->get_override("onRspQryExchangeStatus")(data, error, last); } catch (error_already_set const &) { @@ -3911,11 +3910,11 @@ struct TdApiWrap : TdApi, wrapper < TdApi > } }; - virtual void onRspQryDepthMarketData(dict data, dict error) + virtual void onRspQryDepthMarketData(dict data, dict error, bool last) { try { - this->get_override("onRspQryDepthMarketData")(data, error); + this->get_override("onRspQryDepthMarketData")(data, error, last); } catch (error_already_set const &) {