增加WorkingOrderMonitor

This commit is contained in:
vn.py 2017-08-31 22:25:14 +08:00
parent c12d08ffcc
commit 8060c657ad
4 changed files with 30 additions and 7 deletions

View File

@ -106,6 +106,7 @@ TRADE = u'成交'
ORDER = u'委托'
POSITION = u'持仓'
ACCOUNT = u'账户'
WORKING_ORDER = u'活动委托'
SYSTEM = u'系统'
CONNECT_DATABASE = u'连接数据库'

View File

@ -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'

View File

@ -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()

View File

@ -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_()