From df72b6fde44f1bf3bd2e3a4bc17bc13bec2bc604 Mon Sep 17 00:00:00 2001 From: msincenselee Date: Thu, 8 Jun 2017 17:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E6=97=B6=E6=B3=A8=E9=87=8A=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E7=A7=81=E6=9C=89=E8=A7=86=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/uiMainWindow.py | 51 +++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/vn.trader/uiMainWindow.py b/vn.trader/uiMainWindow.py index ceef510c..0e12b9b5 100644 --- a/vn.trader/uiMainWindow.py +++ b/vn.trader/uiMainWindow.py @@ -6,8 +6,8 @@ from uiBasicWidget import * from ctaStrategy.uiCtaWidget import CtaEngineManager from dataRecorder.uiDrWidget import DrEngineManager from riskManager.uiRmWidget import RmEngineManager -from uiFullMonitorWidget import MonitorWidget -from uiKChartWidget import CandleForm +#from uiFullMonitorWidget import MonitorWidget +#from uiKChartWidget import CandleForm import os @@ -85,6 +85,9 @@ class MainWindow(QtGui.QMainWindow): connectCtpJRAction = QtGui.QAction(u'金瑞CTP', self) connectCtpJRAction.triggered.connect(self.connectCtpJR) + connectCtpJR2Action = QtGui.QAction(u'金瑞CTP2', self) + connectCtpJR2Action.triggered.connect(self.connectCtpJR2) + connectCtpAction = QtGui.QAction(u'连接CTP', self) connectCtpAction.triggered.connect(self.connectCtp) @@ -139,11 +142,11 @@ class MainWindow(QtGui.QMainWindow): ctaAction = QtGui.QAction(u'CTA策略', self) ctaAction.triggered.connect(self.openCta) - monitorAction = QtGui.QAction(u'周期监控', self) - monitorAction.triggered.connect(self.openMonitor) + #monitorAction = QtGui.QAction(u'周期监控', self) + #monitorAction.triggered.connect(self.openMonitor) - kChart = QtGui.QAction(u'K线图', self) - kChart.triggered.connect(self.openKChart) + #kChart = QtGui.QAction(u'K线图', self) + #kChart.triggered.connect(self.openKChart) rmAction = QtGui.QAction(u'风险管理', self) rmAction.triggered.connect(self.openRm) @@ -157,6 +160,7 @@ class MainWindow(QtGui.QMainWindow): sysMenu.addAction(connectCtpPostAction) sysMenu.addAction(connectCtpTestAction) sysMenu.addAction(connectCtpJRAction) + sysMenu.addAction(connectCtpJR2Action) if 'CTP' in self.mainEngine.gatewayDict: sysMenu.addAction(connectCtpAction) @@ -194,8 +198,8 @@ class MainWindow(QtGui.QMainWindow): # 算法相关 algoMenu = menubar.addMenu(u'算法') algoMenu.addAction(ctaAction) - algoMenu.addAction(monitorAction) - algoMenu.addAction(kChart) + #algoMenu.addAction(monitorAction) + #algoMenu.addAction(kChart) # 帮助 helpMenu = menubar.addMenu(u'帮助') @@ -333,6 +337,11 @@ class MainWindow(QtGui.QMainWindow): self.connectGatewayDict['CTP_JR'] = u'金瑞CTP' self.connected = True + def connectCtpJR2(self): + """连接金瑞期货CTP接口""" + self.mainEngine.connect('CTP_JR2') + self.connectGatewayDict['CTP_JR2'] = u'金瑞CTP2' + self.connected = True def connectCtpTest(self): """连接SNOW测试环境CTP接口""" @@ -453,19 +462,19 @@ class MainWindow(QtGui.QMainWindow): self.widgetDict['ctaM'] = CtaEngineManager(self.mainEngine.ctaEngine, self.eventEngine) self.widgetDict['ctaM'].showMaximized() - def openMonitor(self): - try: - self.widgetDict['Monitor'].showMaximized() - except KeyError: - self.widgetDict['Monitor'] = MonitorWidget(self.mainEngine.ctaEngine, self.eventEngine) - self.widgetDict['Monitor'].showMaximized() - - def openKChart(self): - try: - self.widgetDict['kChart'].showMaximized() - except KeyError: - self.widgetDict['kChart'] = CandleForm(self.mainEngine.ctaEngine, self.eventEngine, symbol='p1705', period='minute',interval=5) - self.widgetDict['kChart'].showMaximized() + #def openMonitor(self): + # try: + # self.widgetDict['Monitor'].showMaximized() + # except KeyError: + # self.widgetDict['Monitor'] = MonitorWidget(self.mainEngine.ctaEngine, self.eventEngine) + # self.widgetDict['Monitor'].showMaximized() +# + #def openKChart(self): + # try: + # self.widgetDict['kChart'].showMaximized() + # except KeyError: + # self.widgetDict['kChart'] = CandleForm(self.mainEngine.ctaEngine, self.eventEngine, symbol='p1705', period='minute',interval=5) + # self.widgetDict['kChart'].showMaximized() #----------------------------------------------------------------------