diff --git a/vnpy/app/algo_trading/engine.py b/vnpy/app/algo_trading/engine.py index fb227231..fa72e59b 100644 --- a/vnpy/app/algo_trading/engine.py +++ b/vnpy/app/algo_trading/engine.py @@ -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): diff --git a/vnpy/app/algo_trading/ui/widget.py b/vnpy/app/algo_trading/ui/widget.py index d67f94e0..57b6594c 100644 --- a/vnpy/app/algo_trading/ui/widget.py +++ b/vnpy/app/algo_trading/ui/widget.py @@ -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)