def fetch_instruments_by_exchange(self, exchange_id): '''不能单独用exchange_id,因此没有意义 ''' req = ApiStruct.QryInstrument(ExchangeID=exchange_id, ) self.requestid += 1 r = self.ReqQryInstrument(req, self.requestid) print u'A:查询合约, 函数发出返回值:%s' % r
def fetch_instrument(self, instrument_id): req = UStruct.QryInstrument( InstrumentID=instrument_id, ) ref_id = self.inc_request_id() ret = self.ReqQryInstrument(req, self.inc_request_id()) logging.info('A:查询合约, 函数发出返回值:%s' % ret) return ret
def fetch_instrument(self, instrument_id): #print('fetch_instrument,instrument:'+instrument_id) req = UStruct.QryInstrument( InstrumentID=instrument_id.encode(encoding='utf-8', errors = 'strict'), ) ref_id = self.inc_request_id() ret = self.ReqQryInstrument(req, self.inc_request_id()) logging.info('A:查询合约, 函数发出返回值:%s' % ret) return ret
def query_all_instruments(self, timeout=10): instrument = ApiStruct.QryInstrument() request_id = next(self.request_id) self.ReqQryInstrument(instrument, request_id) instrument_ids = set() response = self.results_map.get(request_id, timeout=timeout) for pInstrument, _ in response: instrument_ids.add(pInstrument.InstrumentID) return instrument_ids
def fetch_instrument(self, instrument_id): req = ApiStruct.QryInstrument(InstrumentID=instrument_id, ) self.requestid += 1 r = self.ReqQryInstrument(req, self.requestid) print u'A:查询合约, 函数发出返回值:%s' % r
def __send__(self): print("RequestInstrument:", self.__request_id__) self.__trader__.ReqQryInstrument( pQryInstrument=ApiStruct.QryInstrument(), nRequestID=self.__request_id__)
def QryInstrument(self, instrument): '''查询合约''' inst = ApiStruct.QryInstrument(InstrumentID=instrument) self.IncReqid() self.ReqQryInstrument(inst, self.requestid)
def fetch_instrument(self, instrument_id): req = ApiStruct.QryInstrument(InstrumentID=instrument_id, ) time.sleep(1) r = self.trader.ReqQryInstrument(req, self.inc_request_id()) logging.info('A:查询合约, 函数发出返回值:%s' % r)