def writeDrLog(self, content): """快速发出日志事件""" log = VtLogData() log.logContent = content event = Event(type_=EVENT_DATARECORDER_LOG) event.dict_['data'] = log self.eventEngine.put(event)
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)
def writeLog(self, content): """快速发出日志事件""" log = VtLogData() log.logContent = content event = Event(EVENT_OM_STRATEGYLOG) event.dict_['data'] = log self.eventEngine.put(event)
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)
def writeLog(self, msg): """""" log = VtLogData() log.logContent = msg event = Event(EVENT_TC_LOG) event.dict_['data'] = log self.eventEngine.put(event)
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)
def writeLog(self, content): """发出日志""" log = VtLogData() log.logContent = content event = Event(EVENT_SPREADTRADING_LOG) event.dict_['data'] = log self.eventEngine.put(event)
def writeLog(self, content): """发出日志 """ log = VtLogData() log.logContent = content event = Event(EVENT_OM_LOG) event.dict_['data'] = log self.eventEngine.put(event)
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)
def writeLog(self, content): """输出日志""" log = VtLogData() log.logContent = content event = Event(EVENT_SPREADTRADING_ALGOLOG) event.dict_['data'] = log self.eventEngine.put(event)
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()
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)
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)
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()
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()
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()
def writeLog(self, content): """发出日志""" log = VtLogData() log.gatewayName = self.gateway.gatewayName log.logContent = content self.gateway.onLog(log)