def test_QryInvestorProductGroupMargin(): ''' 测试QryInvestorProductGroupMargin ''' print '' print '----------------------------------------------------------------------' print 'test_QryInvestorProductGroupMargin():开始' sleep(1) ch = CTPChannel() data = CThostFtdcQryInvestorProductGroupMarginField() errorID,errorMsg,responeDataList = ch.QryInvestorProductGroupMargin(data) if errorID == 0 : print u'共收到%d数据记录' % len(responeDataList) for i,responeData in enumerate(responeDataList): print '---------------------------------%d------------------------------------' % (i + 1) for k,v in responeData.toDict().iteritems(): print k,'=',v,',', print '' else : print u'出错:','errorID=',errorID,'errorMsg=',errorMsg print 'test_QryInvestorProductGroupMargin():请求完成' assert errorID == 0,u'请求失败' print 'test_QryInvestorProductGroupMargin():执行结束' print '----------------------------------------------------------------------'
def test_QryInvestorProductGroupMargin(): ''' 测试QryInvestorProductGroupMargin ''' print '' print '----------------------------------------------------------------------' print u'test_QryInvestorProductGroupMargin():开始' sleep(1) ch = CTPChannel() data = CThostFtdcQryInvestorProductGroupMarginField() startTime = datetime.now() errorID,errorMsg,responeDataList = ch.QryInvestorProductGroupMargin(data) endTime = datetime.now() timeDelta = endTime - startTime print u'test_QryInvestorProductGroupMargin():请求共耗时%f秒' % timeDelta.total_seconds() if errorID == 0 : print u'共收到%d数据记录' % len(responeDataList) for i,responeData in enumerate(responeDataList): print '---------------------------------%d------------------------------------' % (i + 1) for k,v in responeData.toDict().iteritems(): print k,'=',v,',', print '' else : print u'出错:','errorID=',errorID,'errorMsg=',errorMsg print u'test_QryInvestorProductGroupMargin():请求完成' assert errorID == 0 or errorMsg== u'CTP:无此权限',u'请求失败' print u'test_QryInvestorProductGroupMargin():执行结束' print '----------------------------------------------------------------------'