diff --git a/vnpy/trader/language/chinese/text.py b/vnpy/trader/language/chinese/text.py index d503f05c..8a0c6597 100644 --- a/vnpy/trader/language/chinese/text.py +++ b/vnpy/trader/language/chinese/text.py @@ -106,6 +106,7 @@ TRADE = u'成交' ORDER = u'委托' POSITION = u'持仓' ACCOUNT = u'账户' +WORKING_ORDER = u'活动委托' SYSTEM = u'系统' CONNECT_DATABASE = u'连接数据库' diff --git a/vnpy/trader/language/english/text.py b/vnpy/trader/language/english/text.py index a4183d91..f487e853 100644 --- a/vnpy/trader/language/english/text.py +++ b/vnpy/trader/language/english/text.py @@ -107,6 +107,7 @@ TRADE = u'Fill' ORDER = u'Order' POSITION = u'Position' ACCOUNT = u'Account' +WORKING_ORDER = u'Working Order' SYSTEM = u'System' CONNECT_DATABASE = u'Connect Database' diff --git a/vnpy/trader/uiBasicWidget.py b/vnpy/trader/uiBasicWidget.py index ffceb479..c5c0979f 100644 --- a/vnpy/trader/uiBasicWidget.py +++ b/vnpy/trader/uiBasicWidget.py @@ -13,6 +13,7 @@ from .vtGateway import * from . import vtText from .uiQt import QtGui, QtWidgets, QtCore, BASIC_FONT from .vtFunction import jsonPathDict +from .vtConstant import * COLOR_RED = QtGui.QColor('red') @@ -1230,7 +1231,30 @@ class ContractManager(QtWidgets.QWidget): content = str(self.lineFilter.text()) self.monitor.setFilterContent(content) self.monitor.refresh() - + + +######################################################################## +class WorkingOrderMonitor(OrderMonitor): + """活动委托监控""" + STATUS_COMPLETED = [STATUS_ALLTRADED, STATUS_CANCELLED, STATUS_REJECTED] + + #---------------------------------------------------------------------- + def __init__(self, mainEngine, eventEngine, parent=None): + """Constructor""" + super(WorkingOrderMonitor, self).__init__(mainEngine, eventEngine, parent) + + #---------------------------------------------------------------------- + def updateData(self, data): + """更新数据""" + super(WorkingOrderMonitor, self).updateData(data) + + # 如果该委托已完成,则隐藏该行 + if data.status in self.STATUS_COMPLETED: + vtOrderID = data.vtOrderID + cellDict = self.dataDict[vtOrderID] + cell = cellDict['status'] + row = self.row(cell) + self.hideRow(row) ######################################################################## @@ -1313,11 +1337,6 @@ class SettingEditor(QtWidgets.QWidget): # 显示界面 super(SettingEditor, self).show() - - - - - - + diff --git a/vnpy/trader/uiMainWindow.py b/vnpy/trader/uiMainWindow.py index 2fd2769f..c5ceafdd 100644 --- a/vnpy/trader/uiMainWindow.py +++ b/vnpy/trader/uiMainWindow.py @@ -49,6 +49,7 @@ class MainWindow(QtWidgets.QMainWindow): widgetErrorM, dockErrorM = self.createDock(ErrorMonitor, vtText.ERROR, QtCore.Qt.BottomDockWidgetArea) widgetTradeM, dockTradeM = self.createDock(TradeMonitor, vtText.TRADE, QtCore.Qt.BottomDockWidgetArea) widgetOrderM, dockOrderM = self.createDock(OrderMonitor, vtText.ORDER, QtCore.Qt.RightDockWidgetArea) + widgetWorkingOrderM, dockWorkingOrderM = self.createDock(WorkingOrderMonitor, vtText.WORKING_ORDER, QtCore.Qt.BottomDockWidgetArea) widgetPositionM, dockPositionM = self.createDock(PositionMonitor, vtText.POSITION, QtCore.Qt.BottomDockWidgetArea) widgetAccountM, dockAccountM = self.createDock(AccountMonitor, vtText.ACCOUNT, QtCore.Qt.BottomDockWidgetArea) widgetTradingW, dockTradingW = self.createDock(TradingWidget, vtText.TRADING, QtCore.Qt.LeftDockWidgetArea) @@ -56,6 +57,7 @@ class MainWindow(QtWidgets.QMainWindow): self.tabifyDockWidget(dockTradeM, dockErrorM) self.tabifyDockWidget(dockTradeM, dockLogM) self.tabifyDockWidget(dockPositionM, dockAccountM) + self.tabifyDockWidget(dockPositionM, dockWorkingOrderM) dockTradeM.raise_() dockPositionM.raise_()