Example #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)   
Example #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)
Example #3
0
 def writeDrLog(self, content):
     """快速发出日志事件"""
     log = VtLogData()
     log.logContent = content
     event = Event(type_=EVENT_DATARECORDER_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)   
Example #4
0
    def writeLog(self, content):
        """快速发出日志事件"""
        log = VtLogData()
        log.logContent = content

        event = Event(EVENT_OM_STRATEGYLOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
Example #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)
Example #6
0
    def writeLog(self, msg):
        """"""
        log = VtLogData()
        log.logContent = msg

        event = Event(EVENT_TC_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
Example #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)
Example #8
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)         
Example #9
0
 def writeLog(self, msg):
     """"""
     log = VtLogData()
     log.logContent = msg
     
     event = Event(EVENT_TC_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)
Example #10
0
    def writeLog(self, content):
        """发出日志"""
        log = VtLogData()
        log.logContent = content

        event = Event(EVENT_SPREADTRADING_LOG)
        event.dict_['data'] = log
        self.eventEngine.put(event)
Example #11
0
 def writeLog(self, content):
     """发出日志 """
     log = VtLogData()
     log.logContent = content
     
     event = Event(EVENT_OM_LOG)
     event.dict_['data'] = log
     self.eventEngine.put(event)         
Example #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)
Example #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)
Example #14
0
 def writeLog(self, content):
     """输出日志"""
     log = VtLogData()
     log.logContent = content
     
     event = Event(EVENT_SPREADTRADING_ALGOLOG)
     event.dict_['data'] = log
     
     self.eventEngine.put(event)
Example #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()
Example #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)
Example #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)
Example #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()
Example #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)
Example #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()
Example #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()
Example #22
0
 def writeLog(self, content):
     """发出日志"""
     log = VtLogData()
     log.gatewayName = self.gateway.gatewayName
     log.logContent = content
     self.gateway.onLog(log)