示例#1
0
    def initUi(self):
        """初始化界面"""
        self.setWindowTitle(text.DATA_RECORDER)

        # 记录合约配置监控
        tickLabel = QtGui.QLabel(text.TICK_RECORD)
        self.tickTable = QtGui.QTableWidget()
        self.tickTable.setColumnCount(2)
        self.tickTable.verticalHeader().setVisible(False)
        self.tickTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.tickTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tickTable.setAlternatingRowColors(True)
        self.tickTable.setHorizontalHeaderLabels(
            [text.CONTRACT_SYMBOL, text.GATEWAY])

        barLabel = QtGui.QLabel(text.BAR_RECORD)
        self.barTable = QtGui.QTableWidget()
        self.barTable.setColumnCount(2)
        self.barTable.verticalHeader().setVisible(False)
        self.barTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.barTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.barTable.setAlternatingRowColors(True)
        self.barTable.setHorizontalHeaderLabels(
            [text.CONTRACT_SYMBOL, text.GATEWAY])

        activeLabel = QtGui.QLabel(text.DOMINANT_CONTRACT)
        self.activeTable = QtGui.QTableWidget()
        self.activeTable.setColumnCount(2)
        self.activeTable.verticalHeader().setVisible(False)
        self.activeTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.activeTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.activeTable.setAlternatingRowColors(True)
        self.activeTable.setHorizontalHeaderLabels(
            [text.DOMINANT_SYMBOL, text.CONTRACT_SYMBOL])

        # 日志监控
        self.logMonitor = QtGui.QTextEdit()
        self.logMonitor.setReadOnly(True)
        self.logMonitor.setMinimumHeight(600)

        # 设置布局
        grid = QtGui.QGridLayout()

        grid.addWidget(tickLabel, 0, 0)
        grid.addWidget(barLabel, 0, 1)
        grid.addWidget(activeLabel, 0, 2)
        grid.addWidget(self.tickTable, 1, 0)
        grid.addWidget(self.barTable, 1, 1)
        grid.addWidget(self.activeTable, 1, 2)

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(grid)
        vbox.addWidget(self.logMonitor)
        self.setLayout(vbox)
示例#2
0
    def initUi(self):
        """初始化界面"""
        self.setWindowTitle(u'行情数据记录工具')

        # 记录合约配置监控
        tickLabel = QtGui.QLabel(u'Tick记录')
        self.tickTable = QtGui.QTableWidget()
        self.tickTable.setColumnCount(2)
        self.tickTable.verticalHeader().setVisible(False)
        self.tickTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.tickTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tickTable.setAlternatingRowColors(True)
        self.tickTable.setHorizontalHeaderLabels([u'合约代码', u'接口'])

        barLabel = QtGui.QLabel(u'Bar记录')
        self.barTable = QtGui.QTableWidget()
        self.barTable.setColumnCount(2)
        self.barTable.verticalHeader().setVisible(False)
        self.barTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.barTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.barTable.setAlternatingRowColors(True)
        self.barTable.setHorizontalHeaderLabels([u'合约代码', u'接口'])

        activeLabel = QtGui.QLabel(u'主力合约')
        self.activeTable = QtGui.QTableWidget()
        self.activeTable.setColumnCount(2)
        self.activeTable.verticalHeader().setVisible(False)
        self.activeTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.activeTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.activeTable.setAlternatingRowColors(True)
        self.activeTable.setHorizontalHeaderLabels([u'主力代码', u'合约代码'])

        # 日志监控
        self.logMonitor = QtGui.QTextEdit()
        self.logMonitor.setReadOnly(True)
        self.logMonitor.setMinimumHeight(300)

        # 设置布局
        grid = QtGui.QGridLayout()

        grid.addWidget(tickLabel, 0, 0)
        grid.addWidget(barLabel, 0, 1)
        grid.addWidget(activeLabel, 0, 2)
        grid.addWidget(self.tickTable, 1, 0)
        grid.addWidget(self.barTable, 1, 1)
        grid.addWidget(self.activeTable, 1, 2)

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(grid)
        vbox.addWidget(self.logMonitor)
        self.setLayout(vbox)
示例#3
0
    def initUI(self):

        vbox1 = QtGui.QVBoxLayout()
        for x in self.l:
            fileName = "parameter_" + x['name'] + '.json'
            d = {}
            with open(fileName, 'r') as f:
                d = json.load(f)
                f.close()
            symbols = d['postoday'].keys()
            label = [u'策略名\持仓'] + symbols
            newTable = QtGui.QTableWidget(1, 3)
            newTable.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
            newTable.setMaximumHeight(60)
            newTable.setHorizontalHeaderLabels(label)
            vbox1.addWidget(newTable)
            newItem = QtGui.QTableWidgetItem(x['name'])
            newTable.setItem(0, 0, newItem)
            newItem = QtGui.QTableWidgetItem(str(d['postoday'][symbols[0]]))
            newTable.setItem(0, 1, newItem)
            newItem = QtGui.QTableWidgetItem(' ')
            newTable.setItem(0, 2, newItem)
            if len(symbols) == 2:
                newItem = QtGui.QTableWidgetItem(str(
                    d['postoday'][symbols[1]]))
                newTable.setItem(0, 2, newItem)

        self.vbox = vbox1
        self.setLayout(self.vbox)
示例#4
0
    def initUi(self):
        """初始化界面"""
        self.setWindowTitle(u'行情数据记录工具')

        # 菜单
        lineSelect = QtGui.QLabel(u'需要收集的合约:')
        buttonSelect = QtGui.QPushButton(u'选择')

        lineType = QtGui.QLabel(u'合成Bar类型:')
        barType = ['1m', '5m', '15m', '30m', '60m']
        comboType = QtGui.QComboBox()
        comboType.addItems(barType)

        lineStart = QtGui.QLabel(u'开始收集:')
        buttonStart = QtGui.QPushButton(u'收集')

        buttonSelect.clicked.connect(self.select)
        buttonStart.clicked.connect(self.start)

        # 记录合约配置监控
        tickLabel = QtGui.QLabel(u'Tick记录')
        self.tickTable = QtGui.QTableWidget()
        self.tickTable.setColumnCount(2)
        self.tickTable.verticalHeader().setVisible(False)
        self.tickTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.tickTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tickTable.setAlternatingRowColors(True)
        self.tickTable.setHorizontalHeaderLabels([u'合约代码', u'接口'])

        barLabel = QtGui.QLabel(u'Bar记录')
        self.barTable = QtGui.QTableWidget()
        self.barTable.setColumnCount(2)
        self.barTable.verticalHeader().setVisible(False)
        self.barTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.barTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.barTable.setAlternatingRowColors(True)
        self.barTable.setHorizontalHeaderLabels([u'合约代码', u'接口'])

        activeLabel = QtGui.QLabel(u'主力合约')
        self.activeTable = QtGui.QTableWidget()
        self.activeTable.setColumnCount(2)
        self.activeTable.verticalHeader().setVisible(False)
        self.activeTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.activeTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.activeTable.setAlternatingRowColors(True)
        self.activeTable.setHorizontalHeaderLabels([u'主力代码', u'合约代码'])

        # 日志监控
        self.logMonitor = QtGui.QTextEdit()
        self.logMonitor.setReadOnly(True)
        self.logMonitor.setMinimumHeight(600)

        self.logMonitor2 = QtGui.QTextEdit()
        self.logMonitor2.setReadOnly(True)
        self.logMonitor2.setMinimumHeight(600)

        self.logMonitor3 = QtGui.QTextEdit()
        self.logMonitor3.setReadOnly(True)
        self.logMonitor3.setMinimumHeight(600)

        # 设置布局
        hbox = QtGui.QHBoxLayout()
        hbox.addWidget(lineSelect)
        hbox.addWidget(buttonSelect)
        hbox.addWidget(lineType)
        hbox.addWidget(comboType)
        hbox.addWidget(lineStart)
        hbox.addWidget(buttonStart)

        grid = QtGui.QGridLayout()
        grid.addWidget(tickLabel, 0, 0)
        grid.addWidget(barLabel, 0, 1)
        grid.addWidget(activeLabel, 0, 2)
        grid.addWidget(self.tickTable, 1, 0)
        grid.addWidget(self.barTable, 1, 1)
        grid.addWidget(self.activeTable, 1, 2)

        grid2 = QtGui.QGridLayout()
        grid2.addWidget(self.logMonitor, 0, 0)
        grid2.addWidget(self.logMonitor2, 0, 1)
        grid2.addWidget(self.logMonitor3, 0, 2)

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(grid)
        vbox.addLayout(grid2)
        self.setLayout(vbox)
示例#5
0
    def initUi(self):
        """初始化界面"""
        self.setWindowTitle(text.DATA_RECORDER)

        # 记录合约配置监控
        tickLabel = QtGui.QLabel(text.TICK_RECORD)
        self.tickTable = QtGui.QTableWidget()
        self.tickTable.setColumnCount(2)
        self.tickTable.verticalHeader().setVisible(False)
        self.tickTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.tickTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.tickTable.setAlternatingRowColors(True)
        self.tickTable.setHorizontalHeaderLabels(
            [text.CONTRACT_SYMBOL, text.GATEWAY])

        barLabel = QtGui.QLabel(text.BAR_RECORD)
        self.barTable = QtGui.QTableWidget()
        self.barTable.setColumnCount(2)
        self.barTable.verticalHeader().setVisible(False)
        self.barTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.barTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.barTable.setAlternatingRowColors(True)
        self.barTable.setHorizontalHeaderLabels(
            [text.CONTRACT_SYMBOL, text.GATEWAY])

        activeLabel = QtGui.QLabel(text.DOMINANT_CONTRACT)
        self.activeTable = QtGui.QTableWidget()
        self.activeTable.setColumnCount(2)
        self.activeTable.verticalHeader().setVisible(False)
        self.activeTable.setEditTriggers(QtGui.QTableWidget.NoEditTriggers)
        self.activeTable.horizontalHeader().setResizeMode(
            QtGui.QHeaderView.Stretch)
        self.activeTable.setAlternatingRowColors(True)
        self.activeTable.setHorizontalHeaderLabels(
            [text.DOMINANT_SYMBOL, text.CONTRACT_SYMBOL])

        # 日志监控
        self.logMonitor = QtGui.QTextEdit()
        self.logMonitor.setReadOnly(True)
        self.logMonitor.setMinimumHeight(600)

        # 设置布局
        grid = QtGui.QGridLayout()

        grid.addWidget(tickLabel, 0, 0)
        grid.addWidget(barLabel, 0, 1)
        grid.addWidget(activeLabel, 0, 2)
        grid.addWidget(self.tickTable, 1, 0)
        grid.addWidget(self.barTable, 1, 1)
        grid.addWidget(self.activeTable, 1, 2)

        # 原有的布局结构 -> 备份
        # vbox = QtGui.QVBoxLayout()
        # vbox.addLayout(grid)
        # vbox.addWidget(self.logMonitor)
        # self.setLayout(vbox)

        vbox = QtGui.QVBoxLayout()
        vbox.addLayout(grid)
        # 在底部增加的一个可切换组件,有价格图和行情两个界面
        bottomWidget = QtGui.QTabWidget()
        priceWidget = PriceWidget(self.eventEngine, self.drEngine)
        bottomWidget.addTab(priceWidget, u'Price')
        bottomWidget.addTab(self.logMonitor, u'行情')
        vbox.addWidget(bottomWidget)
        self.setLayout(vbox)