From 3de31f6aa8731328e86c5d08a8457460e54501fe Mon Sep 17 00:00:00 2001 From: RT Server Date: Thu, 15 Dec 2016 14:39:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E4=B8=8B=E5=8D=95=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E7=9A=84'=E4=BB=B7=E6=A0=BC'=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=9B=BA=E5=AE=9A=E4=B8=8E=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=8A=9F=E8=83=BD=EF=BC=9A=201.=20=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E2=80=98=E4=BB=B7=E6=A0=BC'self.spinPrice=E8=B7=9F?= =?UTF-8?q?=E9=9A=8Ftick=E6=8E=A8=E9=80=81=E5=8F=98=E5=8C=96=202.=20?= =?UTF-8?q?=E9=80=89=E5=AE=9A=E2=80=99=E4=BB=B7=E6=A0=BC=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E6=A1=86=E2=80=99self.checkFixed=E5=90=8E=EF=BC=8Cself.spinPri?= =?UTF-8?q?ce=E4=B8=8D=E5=86=8D=E6=8E=A5=E6=94=B6tick=E6=8E=A8=E9=80=81?= =?UTF-8?q?=EF=BC=8C=E7=94=B1=E4=BA=A4=E6=98=93=E5=91=98=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=B0=E5=90=88=E9=80=82=E7=9A=84=E5=8F=91?= =?UTF-8?q?=E5=8D=95=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/uiBasicWidget.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/vn.trader/uiBasicWidget.py b/vn.trader/uiBasicWidget.py index 95e61866..1739b287 100644 --- a/vn.trader/uiBasicWidget.py +++ b/vn.trader/uiBasicWidget.py @@ -702,6 +702,7 @@ class TradingWidget(QtGui.QFrame): labelDirection = QtGui.QLabel(u'方向类型') labelOffset = QtGui.QLabel(u'开平') labelPrice = QtGui.QLabel(u'价格') + self.checkFixed = QtGui.QCheckBox(u'') # 价格固定选择框 labelVolume = QtGui.QLabel(u'数量') labelPriceType = QtGui.QLabel(u'价格类型') labelExchange = QtGui.QLabel(u'交易所') @@ -755,17 +756,18 @@ class TradingWidget(QtGui.QFrame): gridleft.addWidget(labelProductClass, 9, 0) gridleft.addWidget(labelGateway, 10, 0) - gridleft.addWidget(self.lineSymbol, 0, 1) - gridleft.addWidget(self.lineName, 1, 1) - gridleft.addWidget(self.comboDirection, 2, 1) - gridleft.addWidget(self.comboOffset, 3, 1) - gridleft.addWidget(self.spinPrice, 4, 1) - gridleft.addWidget(self.spinVolume, 5, 1) - gridleft.addWidget(self.comboPriceType, 6, 1) - gridleft.addWidget(self.comboExchange, 7, 1) - gridleft.addWidget(self.comboCurrency, 8, 1) - gridleft.addWidget(self.comboProductClass, 9, 1) - gridleft.addWidget(self.comboGateway, 10, 1) + gridleft.addWidget(self.lineSymbol, 0, 1, 1, -1) + gridleft.addWidget(self.lineName, 1, 1, 1, -1) + gridleft.addWidget(self.comboDirection, 2, 1, 1, -1) + gridleft.addWidget(self.comboOffset, 3, 1, 1, -1) + gridleft.addWidget(self.checkFixed, 4, 1) + gridleft.addWidget(self.spinPrice, 4, 2) + gridleft.addWidget(self.spinVolume, 5, 1, 1, -1) + gridleft.addWidget(self.comboPriceType, 6, 1, 1, -1) + gridleft.addWidget(self.comboExchange, 7, 1, 1, -1) + gridleft.addWidget(self.comboCurrency, 8, 1, 1, -1) + gridleft.addWidget(self.comboProductClass, 9, 1, 1, -1) + gridleft.addWidget(self.comboGateway, 10, 1, 1, -1) # 右边部分 labelBid1 = QtGui.QLabel(u'买一') @@ -934,7 +936,10 @@ class TradingWidget(QtGui.QFrame): req.exchange = exchange req.currency = currency req.productClass = productClass - + + # 默认跟随价 + self.checkFixed.setChecked(False) + self.mainEngine.subscribe(req, gatewayName) # 更新组件当前交易的合约 @@ -946,6 +951,8 @@ class TradingWidget(QtGui.QFrame): tick = event.dict_['data'] if tick.vtSymbol == self.symbol: + if not self.checkFixed.isChecked(): + self.spinPrice.setValue(tick.lastPrice) self.labelBidPrice1.setText(str(tick.bidPrice1)) self.labelAskPrice1.setText(str(tick.askPrice1)) self.labelBidVolume1.setText(str(tick.bidVolume1))