[Fix]修复手动交易组件的Tick更新机制bug
This commit is contained in:
parent
fe636ade04
commit
90f535d5cb
@ -721,7 +721,7 @@ class TradingWidget(QtWidgets.QFrame):
|
||||
self.gatewayList.extend(gatewayNameList)
|
||||
|
||||
self.initUi()
|
||||
self.connectSignal()
|
||||
self.registerEvent()
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def initUi(self):
|
||||
@ -961,10 +961,6 @@ class TradingWidget(QtWidgets.QFrame):
|
||||
self.labelLastPrice.setText('')
|
||||
self.labelReturn.setText('')
|
||||
|
||||
# 重新注册事件监听
|
||||
self.eventEngine.unregister(EVENT_TICK + self.symbol, self.signal.emit)
|
||||
self.eventEngine.register(EVENT_TICK + vtSymbol, self.signal.emit)
|
||||
|
||||
# 订阅合约
|
||||
req = VtSubscribeReq()
|
||||
req.symbol = symbol
|
||||
@ -984,10 +980,12 @@ class TradingWidget(QtWidgets.QFrame):
|
||||
def updateTick(self, event):
|
||||
"""更新行情"""
|
||||
tick = event.dict_['data']
|
||||
if tick.vtSymbol != self.symbol:
|
||||
return
|
||||
|
||||
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))
|
||||
@ -1023,9 +1021,10 @@ class TradingWidget(QtWidgets.QFrame):
|
||||
self.labelReturn.setText('')
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def connectSignal(self):
|
||||
"""连接Signal"""
|
||||
def registerEvent(self):
|
||||
"""注册事件监听"""
|
||||
self.signal.connect(self.updateTick)
|
||||
self.eventEngine.register(EVENT_TICK, self.signal.emit)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def sendOrder(self):
|
||||
|
Loading…
Reference in New Issue
Block a user