示例#1
0
    def init_tree(self) -> None:
        """"""
        labels = ["数据", "本地代码", "代码", "交易所", "数据量", "开始时间", "结束时间", "", "", ""]

        self.tree = QtWidgets.QTreeWidget()
        self.tree.setColumnCount(len(labels))
        self.tree.setHeaderLabels(labels)
示例#2
0
文件: widget.py 项目: zly111/vnpy
    def init_tree(self) -> None:
        """"""
        labels = [
            "数据",
            "本地代码",
            "代码",
            "交易所",
            "数据量",
            "开始时间",
            "结束时间",
            "",
            ""
        ]

        self.tree = QtWidgets.QTreeWidget()
        self.tree.setColumnCount(len(labels))
        self.tree.setHeaderLabels(labels)

        root = QtWidgets.QTreeWidgetItem(self.tree)
        root.setText(0, "K线数据")
        root.setExpanded(True)

        self.minute_child = QtWidgets.QTreeWidgetItem()
        self.minute_child.setText(0, "分钟线")
        root.addChild(self.minute_child)

        self.hour_child = QtWidgets.QTreeWidgetItem()
        self.hour_child.setText(0, "小时线")
        root.addChild(self.hour_child)

        self.daily_child = QtWidgets.QTreeWidgetItem()
        self.daily_child.setText(0, "日线")
        root.addChild(self.daily_child)
示例#3
0
    def init_tree(self) -> None:
        """"""
        labels = [
            "data", "Native code", "Code", "Exchange", "Amount of data",
            "Start Time", "End Time", "", "", ""
        ]

        self.tree = QtWidgets.QTreeWidget()
        self.tree.setColumnCount(len(labels))
        self.tree.setHeaderLabels(labels)
示例#4
0
文件: widget.py 项目: sdywcd/vnpy-1
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("投资组合")

        labels = [
            "组合名称", "本地代码", "开盘仓位", "当前仓位", "交易盈亏", "持仓盈亏", "总盈亏", "多头成交",
            "空头成交"
        ]
        self.column_count = len(labels)

        self.tree = QtWidgets.QTreeWidget()
        self.tree.setColumnCount(self.column_count)
        self.tree.setHeaderLabels(labels)
        self.tree.header().setDefaultAlignment(QtCore.Qt.AlignCenter)
        self.tree.header().setStretchLastSection(False)

        delegate = TreeDelegate()
        self.tree.setItemDelegate(delegate)

        self.monitor = PortfolioTradeMonitor()

        expand_button = QtWidgets.QPushButton("全部展开")
        expand_button.clicked.connect(self.tree.expandAll)

        collapse_button = QtWidgets.QPushButton("全部折叠")
        collapse_button.clicked.connect(self.tree.collapseAll)

        resize_button = QtWidgets.QPushButton("调整列宽")
        resize_button.clicked.connect(self.resize_columns)

        interval_spin = QtWidgets.QSpinBox()
        interval_spin.setMinimum(1)
        interval_spin.setMaximum(60)
        interval_spin.setSuffix("秒")
        interval_spin.setValue(self.portfolio_engine.get_timer_interval())
        interval_spin.valueChanged.connect(
            self.portfolio_engine.set_timer_interval)

        self.reference_combo = QtWidgets.QComboBox()
        self.reference_combo.setMinimumWidth(200)
        self.reference_combo.addItem("")
        self.reference_combo.currentIndexChanged.connect(
            self.set_reference_filter)

        hbox1 = QtWidgets.QHBoxLayout()
        hbox1.addWidget(expand_button)
        hbox1.addWidget(collapse_button)
        hbox1.addWidget(resize_button)
        hbox1.addStretch()
        hbox1.addWidget(QtWidgets.QLabel("刷新频率"))
        hbox1.addWidget(interval_spin)
        hbox1.addStretch()
        hbox1.addWidget(QtWidgets.QLabel("组合成交"))
        hbox1.addWidget(self.reference_combo)

        hbox2 = QtWidgets.QHBoxLayout()
        hbox2.addWidget(self.tree)
        hbox2.addWidget(self.monitor)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox1)
        vbox.addLayout(hbox2)
        self.setLayout(vbox)