def initUi(self): """初始化界面""" self.setWindowTitle(u'CTA策略') # 按钮 loadButton = QtGui.QPushButton(u'加载策略') startAllButton = QtGui.QPushButton(u'全部启动') stopAllButton = QtGui.QPushButton(u'全部停止') loadButton.clicked.connect(self.load) startAllButton.clicked.connect(self.startAll) stopAllButton.clicked.connect(self.stopAll) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() # CTA组件的日志监控 self.ctaLogMonitor = QtGui.QTextEdit() self.ctaLogMonitor.setReadOnly(True) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(loadButton) hbox2.addWidget(startAllButton) hbox2.addWidget(stopAllButton) hbox2.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.addWidget(self.ctaLogMonitor) self.setLayout(vbox)
def initUi(self): """初始化界面""" self.setWindowTitle(CTA_STRATEGY) # 按钮 startAllButton = QtGui.QPushButton(START_ALL) stopAllButton = QtGui.QPushButton(STOP_ALL) savePositionButton = QtGui.QPushButton(SAVE_POSITION_DATA) startAllButton.clicked.connect(self.startAll) stopAllButton.clicked.connect(self.stopAll) # savePositionButton.clicked.connect(self.ctaEngine.savePosition) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) # CTA组件的日志监控 self.ctaLogMonitor = QtGui.QTextEdit() self.ctaLogMonitor.setReadOnly(True) self.ctaLogMonitor.setMaximumHeight(200) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(startAllButton) hbox2.addWidget(stopAllButton) # hbox2.addWidget(savePositionButton) hbox2.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.addWidget(self.ctaLogMonitor) self.setLayout(vbox)
def __init__(self, l, parent=None): QtGui.QMainWindow.__init__(self, parent) console = MyConsole(self, l) console.setMinimumSize(350, 700) scroll = QtGui.QScrollArea() scroll.setWidget(console) scroll.setAutoFillBackground(True) scroll.setWidgetResizable(True) vbox = QtGui.QVBoxLayout() vbox.addWidget(scroll) self.setLayout(vbox) self.initUI()
def initUi(self): """初始化界面""" self.setWindowTitle(u'CTA策略') # 按钮 newButton = QtGui.QPushButton(u'新建策略') loadButton = QtGui.QPushButton(u'加载策略') initAllButton = QtGui.QPushButton(u'全部初始化') startAllButton = QtGui.QPushButton(u'全部启动') stopAllButton = QtGui.QPushButton(u'全部停止') savePositionButton = QtGui.QPushButton(u'保存持仓') newButton.clicked.connect(self.new) loadButton.clicked.connect(self.load) initAllButton.clicked.connect(self.initAll) startAllButton.clicked.connect(self.startAll) stopAllButton.clicked.connect(self.stopAll) savePositionButton.clicked.connect(self.ctaEngine.savePosition) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) # CTA组件的日志监控 self.ctaLogMonitor = QtGui.QTextEdit() self.ctaLogMonitor.setReadOnly(True) self.ctaLogMonitor.setMaximumHeight(200) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(newButton) hbox2.addWidget(loadButton) hbox2.addWidget(initAllButton) hbox2.addWidget(startAllButton) hbox2.addWidget(stopAllButton) hbox2.addWidget(savePositionButton) hbox2.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.addWidget(self.ctaLogMonitor) self.setLayout(vbox)
def initUi(self): """初始化界面""" self.setWindowTitle(u'CTA策略') # 按钮 loadButton = QtGui.QPushButton(u'加载策略') initAllButton = QtGui.QPushButton(u'全部初始化') startAllButton = QtGui.QPushButton(u'全部启动') stopAllButton = QtGui.QPushButton(u'全部停止') addStrategy = QtGui.QPushButton(u'添加策略') thumbnail = QtGui.QPushButton(u'策略持仓') loadButton.clicked.connect(self.load) initAllButton.clicked.connect(self.initAll) startAllButton.clicked.connect(self.startAll) stopAllButton.clicked.connect(self.stopAll) addStrategy.clicked.connect(self.addStrategy) thumbnail.clicked.connect(self.thumbnail) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) # CTA组件的日志监控 self.ctaLogMonitor = QtGui.QTextEdit() self.ctaLogMonitor.setReadOnly(True) self.ctaLogMonitor.setMaximumHeight(200) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(loadButton) hbox2.addWidget(initAllButton) hbox2.addWidget(startAllButton) hbox2.addWidget(stopAllButton) hbox2.addWidget(addStrategy) hbox2.addWidget(thumbnail) hbox2.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.addWidget(self.ctaLogMonitor) self.setLayout(vbox)
def initUi(self): """初始化界面""" path = os.getcwd().rsplit('\\')[-1] self.setWindowTitle(u'{0} CTA策略'.format(path)) # 按钮 loadButton = QtGui.QPushButton(u'加载策略') initAllButton = QtGui.QPushButton(u'全部初始化') startAllButton = QtGui.QPushButton(u'全部启动') stopAllButton = QtGui.QPushButton(u'全部停止') loadButton.clicked.connect(self.load) initAllButton.clicked.connect(self.initAll) startAllButton.clicked.connect(self.startAll) stopAllButton.clicked.connect(self.stopAll) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) # CTA组件的日志监控 self.ctaLogMonitor = QtGui.QTextEdit() self.ctaLogMonitor.setReadOnly(True) self.ctaLogMonitor.setMaximumHeight(200) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(loadButton) hbox2.addWidget(initAllButton) hbox2.addWidget(startAllButton) hbox2.addWidget(stopAllButton) hbox2.addStretch() vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.addWidget(self.ctaLogMonitor) self.setLayout(vbox)
def initUi(self): """初始化界面""" self.setWindowTitle(u'股票策略回测') # 按钮 newButton = QtGui.QPushButton(u'新建策略') loadButton = QtGui.QPushButton(u'加载策略') newButton.clicked.connect(self.new) loadButton.clicked.connect(self.load) # 滚动区域,放置所有的CtaStrategyManager self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) # 回测结果区域,Tab显示各项报告 self.tabWidget = QtGui.QTabWidget(self) self.model = QtGui.QStandardItemModel(self) self.summaryView = QtGui.QTableView(self) self.summaryView.setModel(self.model) self.summaryView.horizontalHeader().setStretchLastSection(True) self.summaryView.setEditTriggers(self.summaryView.NoEditTriggers) self.summaryView.setMaximumHeight(400) self.summaryView.resizeColumnsToContents() self.model2 = QtGui.QStandardItemModel(self) self.total_portfoliosView = QtGui.QTableView(self) self.total_portfoliosView.setModel(self.model2) self.total_portfoliosView.horizontalHeader().setStretchLastSection( True) self.total_portfoliosView.setEditTriggers( self.total_portfoliosView.NoEditTriggers) self.total_portfoliosView.setMaximumHeight(400) self.total_portfoliosView.resizeColumnsToContents() self.model3 = QtGui.QStandardItemModel(self) self.future_portfoliosView = QtGui.QTableView(self) self.future_portfoliosView.setModel(self.model3) self.future_portfoliosView.horizontalHeader().setStretchLastSection( True) self.future_portfoliosView.setEditTriggers( self.future_portfoliosView.NoEditTriggers) self.future_portfoliosView.setMaximumHeight(400) self.future_portfoliosView.resizeColumnsToContents() self.model4 = QtGui.QStandardItemModel(self) self.future_positionsView = QtGui.QTableView(self) self.future_positionsView.setModel(self.model4) self.future_positionsView.horizontalHeader().setStretchLastSection( True) self.future_positionsView.setEditTriggers( self.future_positionsView.NoEditTriggers) self.future_positionsView.setMaximumHeight(400) self.future_positionsView.resizeColumnsToContents() self.model5 = QtGui.QStandardItemModel(self) self.tradesView = QtGui.QTableView(self) self.tradesView.setModel(self.model5) self.tradesView.horizontalHeader().setStretchLastSection(True) self.tradesView.horizontalHeader().setVisible(False) self.tradesView.setEditTriggers(self.tradesView.NoEditTriggers) self.tradesView.setMaximumHeight(400) self.tradesView.resizeColumnsToContents() self.tabWidget.addTab(self.summaryView, "summary") self.tabWidget.addTab(self.total_portfoliosView, "total_portfolios") self.tabWidget.addTab(self.future_portfoliosView, "stock_portfolios") self.tabWidget.addTab(self.future_positionsView, "stock_positions") self.tabWidget.addTab(self.tradesView, "trades") # 回测图表 Button1 = QtGui.QPushButton(u'交易资料') Button2 = QtGui.QPushButton(u'周期分析') Button3 = QtGui.QPushButton(u'策略分析') Button4 = QtGui.QPushButton(u'交易分析') # Button1.clicked.connect(self.show1) # Button2.clicked.connect(self.show2) # Button3.clicked.connect(self.show3) # Button4.clicked.connect(self.show4) # 回测组件的日志监控 self.bktLogMonitor = QtGui.QTextEdit() self.bktLogMonitor.setReadOnly(True) self.bktLogMonitor.setMaximumHeight(100) # 设置布局 hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(newButton) hbox2.addWidget(loadButton) hbox2.addStretch() vbox2 = QtGui.QVBoxLayout() vbox2.addWidget(Button1) vbox2.addWidget(Button2) vbox2.addWidget(Button3) vbox2.addWidget(Button4) vbox2.addStretch() hbox3 = QtGui.QHBoxLayout() hbox3.addLayout(vbox2) hbox3.addWidget(self.tabWidget) vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox2) vbox.addWidget(self.scrollArea) vbox.setSpacing(20) vbox.addLayout(hbox3) # vbox.addWidget(self.tabWidget) vbox.setSpacing(20) vbox.addWidget(self.bktLogMonitor) self.setLayout(vbox)