예제 #1
0
 def writeDrLog(self, content):
     """快速发出日志事件"""
     log = VtLogData()
     log.logContent = content
     event = Event(type_=EVENT_DATARECORDER_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)   
예제 #2
0
    def writeError(self, content, algo=None):
        """
        输出错误日志
        :param content:
        :param algo:
        :return:
        """
        log = VtLogData()
        log.logContent = content

        if algo:
            log.gatewayName = algo.algoName

        event = Event(EVENT_ALGO_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)

        if algo is not None:
            if algo.algoName in self.strategy_loggers:
                self.strategy_loggers[algo.algoName].error(content)
            else:
                self.createLogger(strategy_name=algo.algoName)
                try:
                    self.strategy_loggers[algo.algoName].error(content)
                except Exception as ex:
                    pass

        self.mainEngine.writeError(content)
예제 #3
0
파일: drEngine.py 프로젝트: QuantFeng/vnpy
 def writeDrLog(self, content):
     """快速发出日志事件"""
     log = VtLogData()
     log.logContent = content
     event = Event(type_=EVENT_DATARECORDER_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)   
예제 #4
0
    def writeLog(self, content):
        """快速发出日志事件"""
        log = VtLogData()
        log.logContent = content

        event = Event(EVENT_OM_STRATEGYLOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #5
0
 def writeLog(self, content):
     """发出日志事件"""
     log = VtLogData()
     log.logContent = content
     log.gatewayName = 'JAQS_SERVICE'
     event = Event(type_=EVENT_JS_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)
예제 #6
0
    def writeLog(self, msg):
        """"""
        log = VtLogData()
        log.logContent = msg

        event = Event(EVENT_TC_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #7
0
 def writeLog(self, content):
     """快速发出日志事件"""
     log = VtLogData()
     log.logContent = content
     log.gatewayName = 'SLIPPERY_GRID_ENGINE'
     event = Event(type_=EVENT_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)
예제 #8
0
파일: jsEngine.py 프로젝트: GenesisOrg/vnpy
 def writeLog(self, content):
     """发出日志事件"""
     log = VtLogData()
     log.logContent = content
     log.gatewayName = 'JAQS_SERVICE'
     event = Event(type_=EVENT_JS_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)         
예제 #9
0
파일: tcEngine.py 프로젝트: roccox/vnpy
 def writeLog(self, msg):
     """"""
     log = VtLogData()
     log.logContent = msg
     
     event = Event(EVENT_TC_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)
예제 #10
0
    def writeLog(self, content):
        """发出日志"""
        log = VtLogData()
        log.logContent = content

        event = Event(EVENT_SPREADTRADING_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #11
0
파일: omEngine.py 프로젝트: h1222443/vnpy
 def writeLog(self, content):
     """发出日志 """
     log = VtLogData()
     log.logContent = content
     
     event = Event(EVENT_OM_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)         
예제 #12
0
 def writeLog(self, content):
     """记录日志"""
     log = VtLogData()
     log.logContent = content
     log.gatewayName = self.ENGINE_NAME
     
     event = Event(EVENT_RTDSERVICE_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)
예제 #13
0
    def writeLog(self, content):
        """记录日志"""
        log = VtLogData()
        log.logContent = content
        log.gatewayName = self.ENGINE_NAME

        event = Event(EVENT_RTDSERVICE_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #14
0
파일: stEngine.py 프로젝트: h1222443/vnpy
 def writeLog(self, content):
     """输出日志"""
     log = VtLogData()
     log.logContent = content
     
     event = Event(EVENT_SPREADTRADING_ALGOLOG)
     event.dict_['data'] = log
     
     self.eventEngine.put(event)
예제 #15
0
 def writeLog(self, content):
     try:
         log = VtLogData()
         log.logContent = content
         log.gatewayName = 'OPTION_SELECTOR_ENGINE'
         event = Event(type_=EVENT_LOG)
         event.dict_['data'] = log
         self.eventEngine.put(event)
     except:
         traceback.print_exc()
예제 #16
0
    def writeLog(self, content, signal=None):
        """输出日志"""
        log = VtLogData()
        log.logContent = content
        
        if signal:
            log.gatewayName = signal.signalName

        event = Event(EVENT_SIGNAL_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #17
0
    def writeLog(self, content, algo=None):
        """输出日志"""
        log = VtLogData()
        log.logContent = content
        
        if algo:
            log.gatewayName = algo.algoName

        event = Event(EVENT_ALGO_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #18
0
 def writeLog(self, content):
     try:
         """快速发出日志事件"""
         log = VtLogData()
         log.logContent = content
         log.gatewayName = 'STOPORDER_MAIN_WINDOW'
         event = Event(type_=EVENT_LOG)
         event.dict_['data'] = log
         self.eventEngine.put(event)
     except:
         traceback.print_exc()
예제 #19
0
    def writeLog(self, content, algo=None):
        """输出日志"""
        log = VtLogData()
        log.logContent = content

        if algo:
            log.gatewayName = algo.algoName

        event = Event(EVENT_ALGO_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
예제 #20
0
 def writeLog(self, content):
     try:
         """快速发出日志事件"""
         log = VtLogData()
         log.logContent = content
         log.gatewayName = 'CATCH_LIMITUP_ENGINE'
         event = Event(type_=EVENT_LOG)
         event.dict_['data'] = log
         self.eventEngine.put(event)
     except:
         traceback.print_exc()
예제 #21
0
    def connect(self):
        """连接"""
        try:
            f = open(self.filePath, "r")
        except IOError:
            log = VtLogData()
            log.gatewayName = self.gatewayName
            log.logContent = u'读取连接配置出错,请检查'
            self.onLog(log)
            return

        # 解析json文件
        setting = json.load(f)
        try:
            token = str(setting["token"])
            practice = bool(setting.get("practice", True))
            symbols = setting.get("symbols", None)
            qryEnabled = setting.get("qryEnabled", False)
            if symbols:
                assert isinstance(
                    symbols, (str, list)
                ), "type %s is not valid symbols type, must be list or str" % type(
                    symbols)
            else:
                symbols = None
        except KeyError:
            log = VtLogData()
            log.gatewayName = self.gatewayName
            log.logContent = u'连接配置缺少字段,请检查'
            self.onLog(log)
            return
        if practice:
            self.api = VnOandaPracticeApi(self)
        else:
            self.api = VnOandaApi(self)
        self.setQryEnabled(qryEnabled)
        # 创建行情和交易接口对象
        self.connected = self.api.connect(token)
        if self.connected:
            self.api.subscribe(symbols)
            self.initQuery()
예제 #22
0
 def writeLog(self, content):
     """发出日志"""
     log = VtLogData()
     log.gatewayName = self.gateway.gatewayName
     log.logContent = content
     self.gateway.onLog(log)