[Mod] use logdata for EVENT_ALGO_LOG

This commit is contained in:
vn.py 2019-10-12 22:38:57 +08:00
parent cd612e41d8
commit 95a5dc7298
2 changed files with 5 additions and 4 deletions

View File

@ -4,7 +4,7 @@ from vnpy.trader.engine import BaseEngine, MainEngine
from vnpy.trader.event import (
EVENT_TICK, EVENT_TIMER, EVENT_ORDER, EVENT_TRADE)
from vnpy.trader.constant import (Direction, Offset, OrderType)
from vnpy.trader.object import (SubscribeRequest, OrderRequest)
from vnpy.trader.object import (SubscribeRequest, OrderRequest, LogData)
from vnpy.trader.utility import load_json, save_json, round_to
from .template import AlgoTemplate
@ -224,8 +224,8 @@ class AlgoEngine(BaseEngine):
if algo:
msg = f"{algo.algo_name}{msg}"
event = Event(EVENT_ALGO_LOG)
event.data = msg
log = LogData(msg=msg, gateway_name=APP_NAME)
event = Event(EVENT_ALGO_LOG, data=log)
self.event_engine.put(event)
def put_setting_event(self, setting_name: str, setting: dict):

View File

@ -520,7 +520,8 @@ class LogMonitor(QtWidgets.QTableWidget):
def process_log_event(self, event):
""""""
msg = event.data
log = event.data
msg = log.msg
timestamp = datetime.now().strftime("%H:%M:%S")
timestamp_cell = QtWidgets.QTableWidgetItem(timestamp)