def qryPosition(self, InstrumentID=''): self.requestid += 1 if InstrumentID: req = ApiStruct.QryInvestorPosition(BrokerID=self.broker_id, InvestorID=self.investor_id, InstrumentID=InstrumentID) else: req = ApiStruct.QryInvestorPosition(BrokerID=self.broker_id, InvestorID=self.investor_id) self.ReqQryInvestorPosition(req, self.requestid)
def fetch_investor_position(self, instrument_id): #获取合约的当前持仓 print u'A:获取合约%s的当前持仓..' % (instrument_id, ) req = ApiStruct.QryInvestorPosition(BrokerID=self.broker_id, InvestorID=self.investor_id, InstrumentID=instrument_id) self.requestid += 1 r = self.ReqQryInvestorPosition(req, self.requestid)
def fetch_investor_position(self, instrument_id): #获取合约的当前持仓 logging.info('A:获取合约%s的当前持仓..' % (instrument_id, )) req = UStruct.QryInvestorPosition(BrokerID=self._broker, InvestorID=self._investor, InstrumentID=instrument_id) ref_id = self.inc_request_id() ret = self.ReqQryInvestorPosition(req, self.ref_id) #logging.info('A:查询持仓, 函数发出返回值:%s' % rP) return ret,ref_id
def OnRspSettlementInfoConfirm(self, pSettlementInfoConfirm, pRspInfo, nRequestID, bIsLast): self.logger.info('投资者结算结果确认完毕!') self.logger.info('\t确认日期: %s', pSettlementInfoConfirm.ConfirmDate) self.logger.info('\t确认时间: %s', pSettlementInfoConfirm.ConfirmTime) self.request_id += 1 self.logger.info('开始持仓查询:') self.ReqQryInvestorPosition( ApiStruct.QryInvestorPosition(self.broker_id, self.investor_id, self.instruimentIDs[0]), self.request_id) time.sleep(1) self.request_id += 1 self.ReqQryInvestorPosition( ApiStruct.QryInvestorPosition(self.broker_id, self.investor_id, self.instruimentIDs[1]), self.request_id) time.sleep(1)