예제 #1
0
    def user_login(self, broker_id, investor_id, password):
        req = ApiStruct.ReqUserLogin(BrokerID=broker_id,
                                     UserID=investor_id,
                                     Password=password)

        self.request_id += 1
        ret = self.ReqUserLogin(req, self.request_id)
예제 #2
0
파일: Strategy.py 프로젝트: pqctp/pqctp
 def formatOrder(self, inst, direc, open_close, volume, price):
     return ApiStruct.InputOrder(
         InstrumentID=inst,
         Direction=direc,  # ApiStruct.D_Buy or ApiStruct.D_Sell
         OrderRef=str(Strategy.traderSpi.inc_request_id()),
         LimitPrice=price,
         VolumeTotalOriginal=volume,
         OrderPriceType=ApiStruct.OPT_LimitPrice,
         BrokerID=Strategy.traderSpi.broker_id,
         InvestorID=Strategy.traderSpi.investor_id,
         CombOffsetFlag=open_close,  # OF_Open, OF_Close, OF_CloseToday
         CombHedgeFlag=ApiStruct.HF_Speculation,
         VolumeCondition=ApiStruct.VC_AV,
         MinVolume=1,
         ForceCloseReason=ApiStruct.FCC_NotForceClose,
         IsAutoSuspend=1,
         UserForceClose=0,
         TimeCondition=ApiStruct.TC_GFD,
     )
예제 #3
0
 def OnRspUserLogin(self, userlogin, info, rid, is_last):
     if is_last and not self.isErrorRspInfo(info):
         logger.info('OnRspUserLogin %s' % is_last)
         req = ApiStruct.SettlementInfoConfirm(BrokerID=self.broker_id, InvestorID=self.investor_id)
         self.ReqSettlementInfoConfirm(req, self.inc_request_id())
예제 #4
0
 def OnFrontConnected(self):
     logger.info('OnFrontConnected')
     req = ApiStruct.ReqUserLogin(BrokerID=self.broker_id, UserID=self.investor_id, Password=self.passwd)
     self.ReqUserLogin(req, self.inc_request_id())