[Add]增加无界面模式下对错误信息的输出,Close #702
This commit is contained in:
parent
691a574ddf
commit
9fdfb253f0
@ -9,13 +9,23 @@ from time import sleep
|
||||
from datetime import datetime, time
|
||||
|
||||
from vnpy.event import EventEngine2
|
||||
from vnpy.trader.vtEvent import EVENT_LOG
|
||||
from vnpy.trader.vtEvent import EVENT_LOG, EVENT_ERROR
|
||||
from vnpy.trader.vtEngine import MainEngine, LogEngine
|
||||
from vnpy.trader.gateway import ctpGateway
|
||||
from vnpy.trader.app import ctaStrategy
|
||||
from vnpy.trader.app.ctaStrategy.ctaBase import EVENT_CTA_LOG
|
||||
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def processErrorEvent(event):
|
||||
"""
|
||||
处理错误事件
|
||||
错误信息在每次登陆后,会将当日所有已产生的均推送一遍,所以不适合写入日志
|
||||
"""
|
||||
error = event.dict_['data']
|
||||
print u'错误代码:%s,错误信息:%s' %(error.errorID, error.errorMsg)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def runChildProcess():
|
||||
"""子进程运行函数"""
|
||||
@ -39,6 +49,7 @@ def runChildProcess():
|
||||
|
||||
ee.register(EVENT_LOG, le.processLogEvent)
|
||||
ee.register(EVENT_CTA_LOG, le.processLogEvent)
|
||||
ee.register(EVENT_ERROR, processErrorEvent)
|
||||
le.info(u'注册日志事件监听')
|
||||
|
||||
me.connect('CTP')
|
||||
|
@ -5,11 +5,18 @@ from time import sleep
|
||||
from datetime import datetime, time
|
||||
|
||||
from vnpy.event import EventEngine2
|
||||
from vnpy.trader.vtEvent import EVENT_LOG
|
||||
from vnpy.trader.vtEvent import EVENT_LOG, EVENT_ERROR
|
||||
from vnpy.trader.vtEngine import MainEngine, LogEngine
|
||||
from vnpy.trader.gateway import ctpGateway
|
||||
from vnpy.trader.app import dataRecorder
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def processErrorEvent(event):
|
||||
"""处理错误事件"""
|
||||
error = event.dict_['data']
|
||||
print u'错误代码:%s,错误信息:%s' %(error.errorID, error.errorMsg)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def runChildProcess():
|
||||
"""子进程运行函数"""
|
||||
@ -30,6 +37,7 @@ def runChildProcess():
|
||||
le.info(u'主引擎创建成功')
|
||||
|
||||
ee.register(EVENT_LOG, le.processLogEvent)
|
||||
ee.register(EVENT_ERROR, processErrorEvent)
|
||||
le.info(u'注册日志事件监听')
|
||||
|
||||
me.connect('CTP')
|
||||
|
Loading…
Reference in New Issue
Block a user