コード例 #1
0
ファイル: widget.py プロジェクト: edword01/vnpy
    def init_ui(self):
        """"""
        self.setWindowTitle("移除价差")
        self.setMinimumWidth(300)

        self.name_combo = QtWidgets.QComboBox()
        spreads = self.spread_engine.get_all_spreads()
        for spread in spreads:
            self.name_combo.addItem(spread.name)

        button_remove = QtWidgets.QPushButton("移除")
        button_remove.clicked.connect(self.remove_spread)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.name_combo)
        hbox.addWidget(button_remove)

        self.setLayout(hbox)
コード例 #2
0
    def init_ui(self):
        """"""
        form = QtWidgets.QFormLayout()

        # Add vt_symbol and name edit if add new strategy
        if self.class_name:
            self.setWindowTitle(f"添加策略:{self.class_name}")
            button_text = "添加"
            parameters = {"strategy_name": "", "vt_symbol": ""}
            parameters.update(self.parameters)
        else:
            self.setWindowTitle(f"参数编辑:{self.strategy_name}")
            button_text = "确定"
            parameters = self.parameters

        for name, value in parameters.items():
            type_ = type(value)

            edit = QtWidgets.QLineEdit(str(value))
            if type_ is int:
                validator = QtGui.QIntValidator()
                edit.setValidator(validator)
            elif type_ is float:
                validator = QtGui.QDoubleValidator()
                edit.setValidator(validator)

            form.addRow(f"{name} {type_}", edit)

            self.edits[name] = (edit, type_)

        button = QtWidgets.QPushButton(button_text)
        button.clicked.connect(self.accept)
        form.addRow(button)

        widget = QtWidgets.QWidget()
        widget.setLayout(form)

        scroll = QtWidgets.QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(widget)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(scroll)
        self.setLayout(vbox)
コード例 #3
0
    def init_ui(self):
        """"""
        self.setWindowTitle("参数优化结果")
        self.resize(1100, 500)

        # Creat table to show result
        table = QtWidgets.QTableWidget()

        table.setColumnCount(2)
        table.setRowCount(len(self.result_values))
        table.setHorizontalHeaderLabels(["参数", self.target_display])
        table.setEditTriggers(table.NoEditTriggers)
        table.verticalHeader().setVisible(False)

        table.horizontalHeader().setSectionResizeMode(
            0, QtWidgets.QHeaderView.ResizeToContents)
        table.horizontalHeader().setSectionResizeMode(
            1, QtWidgets.QHeaderView.Stretch)

        for n, tp in enumerate(self.result_values):
            setting, target_value, _ = tp
            setting_cell = QtWidgets.QTableWidgetItem(str(setting))
            target_cell = QtWidgets.QTableWidgetItem(str(target_value))

            setting_cell.setTextAlignment(QtCore.Qt.AlignCenter)
            target_cell.setTextAlignment(QtCore.Qt.AlignCenter)

            table.setItem(n, 0, setting_cell)
            table.setItem(n, 1, target_cell)

        # Create layout
        button = QtWidgets.QPushButton("保存")
        button.clicked.connect(self.save_csv)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addStretch()
        hbox.addWidget(button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(table)
        vbox.addLayout(hbox)

        self.setLayout(vbox)
コード例 #4
0
ファイル: widget.py プロジェクト: systemtrader/vnpy_mod
    def init_ui(self):
        self.setWindowTitle("同步仓位")
        self.setMinimumWidth(300)

        # Select symbol widget
        self.sync_symbol_combo = ComboBox()
        self.sync_symbol_combo.pop_show.connect(self.refresh_symbol_list)
        self.sync_symbol_combo.activated[str].connect(self.set_sync_symbol)

        # Sync action button
        self.sync_open_button = QtWidgets.QPushButton("单合约开仓同步")
        self.sync_open_button.clicked.connect(self.sync_open)

        self.sync_close_button = QtWidgets.QPushButton("单合约平仓同步")
        self.sync_close_button.clicked.connect(self.sync_close)

        self.sync_button = QtWidgets.QPushButton("单合约开平同步")
        self.sync_button.clicked.connect(self.sync_open_and_close)

        self.sync_all_button = QtWidgets.QPushButton("所有持仓同步")
        self.sync_all_button.clicked.connect(self.sync_all)

        self.sync_net_button = QtWidgets.QPushButton("日内交易同步")
        self.sync_net_button.clicked.connect(lambda: self.sync_net_delta(is_sync_baisc=False))

        self.sync_basic_button = QtWidgets.QPushButton("日内底仓同步")
        self.sync_basic_button.clicked.connect(lambda: self.sync_net_delta(is_sync_baisc=True))

        for btn in [self.sync_open_button,
                    self.sync_close_button,
                    self.sync_button,
                    self.sync_all_button,
                    self.sync_net_button,
                    self.sync_basic_button]:
            btn.setFixedHeight(btn.sizeHint().height() * 1.5)

        # Set layout
        form_sync = QtWidgets.QFormLayout()
        form_sync.addRow("同步合约", self.sync_symbol_combo)
        form_sync.addRow(self.sync_open_button)
        form_sync.addRow(self.sync_close_button)
        form_sync.addRow(self.sync_button)
        form_sync.addRow(self.sync_all_button)
        form_sync.addRow(self.sync_net_button)
        form_sync.addRow(self.sync_basic_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form_sync)

        self.setLayout(vbox)
コード例 #5
0
    def __init__(self, start: datetime, end: datetime, parent=None):
        """"""
        super().__init__(parent)

        self.setWindowTitle("选择数据区间")

        self.start_edit = QtWidgets.QDateEdit(
            QtCore.QDate(start.year, start.month, start.day))
        self.end_edit = QtWidgets.QDateEdit(
            QtCore.QDate(end.year, end.month, end.day))

        button = QtWidgets.QPushButton("确定")
        button.clicked.connect(self.accept)

        form = QtWidgets.QFormLayout()
        form.addRow("开始时间", self.start_edit)
        form.addRow("结束时间", self.end_edit)
        form.addRow(button)

        self.setLayout(form)
コード例 #6
0
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("K线图表")

        self.tab: QtWidgets.QTabWidget = QtWidgets.QTabWidget()
        self.symbol_line: QtWidgets.QLineEdit = QtWidgets.QLineEdit()

        self.button = QtWidgets.QPushButton("新建图表")
        self.button.clicked.connect(self.new_chart)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(QtWidgets.QLabel("本地代码"))
        hbox.addWidget(self.symbol_line)
        hbox.addWidget(self.button)
        hbox.addStretch()

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addWidget(self.tab)

        self.setLayout(vbox)
コード例 #7
0
    def __init__(self, engine: ManagerEngine, parent=None):
        """"""
        super().__init__()

        self.engine = engine

        self.setWindowTitle("下载历史数据")
        self.setFixedWidth(300)

        self.setWindowFlags((self.windowFlags()
                             | QtCore.Qt.CustomizeWindowHint)
                            & ~QtCore.Qt.WindowMaximizeButtonHint)

        self.symbol_edit = QtWidgets.QLineEdit()

        self.exchange_combo = QtWidgets.QComboBox()
        for i in Exchange:
            self.exchange_combo.addItem(str(i.name), i)

        self.interval_combo = QtWidgets.QComboBox()
        for i in Interval:
            self.interval_combo.addItem(str(i.name), i)

        end_dt = datetime.now()
        start_dt = end_dt - timedelta(days=3 * 365)

        self.start_date_edit = QtWidgets.QDateEdit(
            QtCore.QDate(start_dt.year, start_dt.month, start_dt.day))

        button = QtWidgets.QPushButton("下载")
        button.clicked.connect(self.download)

        form = QtWidgets.QFormLayout()
        form.addRow("代码", self.symbol_edit)
        form.addRow("交易所", self.exchange_combo)
        form.addRow("周期", self.interval_combo)
        form.addRow("开始日期", self.start_date_edit)
        form.addRow(button)

        self.setLayout(form)
コード例 #8
0
    def init_ui(self):
        """"""
        self.setWindowTitle("模拟交易")
        self.setFixedHeight(200)
        self.setFixedWidth(500)

        interval_spin = QtWidgets.QSpinBox()
        interval_spin.setMinimum(1)
        interval_spin.setValue(self.paper_engine.timer_interval)
        interval_spin.setSuffix(" 秒")
        interval_spin.valueChanged.connect(
            self.paper_engine.set_timer_interval)

        slippage_spin = QtWidgets.QSpinBox()
        slippage_spin.setMinimum(0)
        slippage_spin.setValue(self.paper_engine.trade_slippage)
        slippage_spin.setSuffix(" 跳")
        slippage_spin.valueChanged.connect(
            self.paper_engine.set_trade_slippage)

        instant_check = QtWidgets.QCheckBox()
        instant_check.setChecked(self.paper_engine.instant_trade)
        instant_check.stateChanged.connect(self.paper_engine.set_instant_trade)

        clear_button = QtWidgets.QPushButton("清空所有持仓")
        clear_button.clicked.connect(self.paper_engine.clear_position)
        clear_button.setFixedHeight(clear_button.sizeHint().height() * 2)

        form = QtWidgets.QFormLayout()
        form.addRow("市价委托和停止委托的成交滑点", slippage_spin)
        form.addRow("模拟交易持仓盈亏的计算频率", interval_spin)
        form.addRow("下单后立即使用当前盘口撮合", instant_check)
        form.addRow(clear_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addStretch()
        vbox.addLayout(form)
        vbox.addStretch()
        self.setLayout(vbox)
コード例 #9
0
    def init_ui(self):
        # 编辑器的多行文本框
        # self.editor_textarea = QtWidgets.QTextEdit()
        self.editor_textarea = MyLangEditor()
        # self.editor_textarea = CodeEditor()
        # 设置editor背景颜色
        # self.editor_textarea.setStyleSheet("background:white")
        self.editor_textarea.textChanged.connect(self.handle_text_changed)
        # self.highlighter = PythonHighlighter(self.editor_textarea.document())
        editor_textarea_box = QtWidgets.QVBoxLayout()
        editor_textarea_box.addWidget(self.editor_textarea)

        save_button = QtWidgets.QPushButton("保存")
        save_button.clicked.connect(self.save_script)
        save_as_button = QtWidgets.QPushButton("另存为")
        save_as_button.clicked.connect(self.save_script_as)
        interprete_button = QtWidgets.QPushButton("编译")
        interprete_button.clicked.connect(self.interprete)
        start_button = QtWidgets.QPushButton("启动")
        start_button.clicked.connect(self.start_script)
        stop_button = QtWidgets.QPushButton("停止")
        stop_button.clicked.connect(self.stop_script)
        clear_button = QtWidgets.QPushButton("清空编辑器")
        clear_button.clicked.connect(self.editor_textarea.clear)

        button_box = QtWidgets.QHBoxLayout()
        button_box.addWidget(save_button)
        button_box.addWidget(save_as_button)
        button_box.addWidget(interprete_button)
        button_box.addWidget(start_button)
        button_box.addWidget(stop_button)
        button_box.addStretch()
        button_box.addWidget(clear_button)

        strategy_name_box = QtWidgets.QHBoxLayout()
        self.current_strategy_name = QtWidgets.QTextEdit()
        self.current_strategy_name.setReadOnly(True)
        self.current_strategy_name.setPlainText("策略名称:未保存策略")
        strategy_name_box.addWidget(self.current_strategy_name)

        self.addLayout(button_box)
        self.addLayout(strategy_name_box)
        self.addLayout(editor_textarea_box)
        self.setStretch(0, 1)
        self.setStretch(1, 1)
        self.setStretch(2, 18)
コード例 #10
0
ファイル: widget.py プロジェクト: oness001/vnpy
    def init_ui(self):
        """"""
        self.setWindowTitle("交易风控")

        # Create widgets
        self.active_combo = QtWidgets.QComboBox()
        self.active_combo.addItems(["停止", "启动"])

        self.flow_limit_spin = RiskManagerSpinBox()
        self.flow_clear_spin = RiskManagerSpinBox()
        self.size_limit_spin = RiskManagerSpinBox()
        self.trade_limit_spin = RiskManagerSpinBox()
        self.active_limit_spin = RiskManagerSpinBox()
        self.cancel_limit_spin = RiskManagerSpinBox()
        self.position_limit_spin = RiskManagerSpinBox()

        save_button = QtWidgets.QPushButton("保存")
        save_button.clicked.connect(self.save_setting)

        # Form layout
        form = QtWidgets.QFormLayout()
        form.addRow("风控运行状态", self.active_combo)
        form.addRow("委托流控上限(笔)", self.flow_limit_spin)
        form.addRow("委托流控清空(秒)", self.flow_clear_spin)
        form.addRow("单笔委托上限(数量)", self.size_limit_spin)
        form.addRow("总成交上限(笔)", self.trade_limit_spin)
        form.addRow("活动委托上限(笔)", self.active_limit_spin)
        form.addRow("合约撤单上限(笔)", self.cancel_limit_spin)
        form.addRow("暴露头寸上限(手)", self.position_limit_spin)
        form.addRow(save_button)

        self.setLayout(form)

        # Set Fix Size
        hint = self.sizeHint()
        self.setFixedSize(hint.width() * 1.2, hint.height())
コード例 #11
0
ファイル: widget_jnpy.py プロジェクト: jojoquant/jonpy
    def init_ui(self):
        """"""
        form = QtWidgets.QFormLayout()

        for key, column_name_list in self.column_name_combo_dict.items():
            column_name_combo = QtWidgets.QComboBox()
            for column_name in column_name_list:
                column_name_combo.addItem(f'{column_name}', column_name)
            self.column_name_combo_dict[key] = column_name_combo
            form.addRow(key, column_name_combo)

        # Add vt_symbol and name edit if add new strategy
        self.setWindowTitle(f"技术指标参数配置:{self.class_name}")
        button_text = "确定"
        parameters = self.parameters

        for name, value in parameters.items():
            type_ = type(value)

            edit = QtWidgets.QLineEdit(str(value))
            if type_ is int:
                validator = QtGui.QIntValidator()
                edit.setValidator(validator)
            elif type_ is float:
                validator = QtGui.QDoubleValidator()
                edit.setValidator(validator)

            form.addRow(f"{name} {type_}", edit)

            self.edits[name] = (edit, type_)

        button = QtWidgets.QPushButton(button_text)
        button.clicked.connect(self.accept)
        form.addRow(button)

        self.setLayout(form)
コード例 #12
0
    def __init__(self, parent=None):
        """"""
        super().__init__()

        self.setWindowTitle("从CSV文件导入数据")
        self.setFixedWidth(300)

        self.setWindowFlags((self.windowFlags()
                             | QtCore.Qt.CustomizeWindowHint)
                            & ~QtCore.Qt.WindowMaximizeButtonHint)

        file_button = QtWidgets.QPushButton("选择文件")
        file_button.clicked.connect(self.select_file)

        load_button = QtWidgets.QPushButton("确定")
        load_button.clicked.connect(self.accept)

        self.file_edit = QtWidgets.QLineEdit()
        self.symbol_edit = QtWidgets.QLineEdit()

        self.exchange_combo = QtWidgets.QComboBox()
        for i in Exchange:
            self.exchange_combo.addItem(str(i.name), i)

        self.interval_combo = QtWidgets.QComboBox()
        for i in Interval:
            if i != Interval.TICK:
                self.interval_combo.addItem(str(i.name), i)

        self.datetime_edit = QtWidgets.QLineEdit("datetime")
        self.open_edit = QtWidgets.QLineEdit("open")
        self.high_edit = QtWidgets.QLineEdit("high")
        self.low_edit = QtWidgets.QLineEdit("low")
        self.close_edit = QtWidgets.QLineEdit("close")
        self.volume_edit = QtWidgets.QLineEdit("volume")
        self.open_interest_edit = QtWidgets.QLineEdit("open_interest")

        self.format_edit = QtWidgets.QLineEdit("%Y-%m-%d %H:%M:%S")

        info_label = QtWidgets.QLabel("合约信息")
        info_label.setAlignment(QtCore.Qt.AlignCenter)

        head_label = QtWidgets.QLabel("表头信息")
        head_label.setAlignment(QtCore.Qt.AlignCenter)

        format_label = QtWidgets.QLabel("格式信息")
        format_label.setAlignment(QtCore.Qt.AlignCenter)

        form = QtWidgets.QFormLayout()
        form.addRow(file_button, self.file_edit)
        form.addRow(QtWidgets.QLabel())
        form.addRow(info_label)
        form.addRow("代码", self.symbol_edit)
        form.addRow("交易所", self.exchange_combo)
        form.addRow("周期", self.interval_combo)
        form.addRow(QtWidgets.QLabel())
        form.addRow(head_label)
        form.addRow("时间戳", self.datetime_edit)
        form.addRow("开盘价", self.open_edit)
        form.addRow("最高价", self.high_edit)
        form.addRow("最低价", self.low_edit)
        form.addRow("收盘价", self.close_edit)
        form.addRow("成交量", self.volume_edit)
        form.addRow("持仓量", self.open_interest_edit)
        form.addRow(QtWidgets.QLabel())
        form.addRow(format_label)
        form.addRow("时间格式", self.format_edit)
        form.addRow(QtWidgets.QLabel())
        form.addRow(load_button)

        self.setLayout(form)
コード例 #13
0
ファイル: widget.py プロジェクト: sdywcd/vnpy-1
    def refresh_tree(self) -> None:
        """"""
        self.clear_tree()

        data = self.engine.get_bar_data_available()

        for d in data:
            key = (d["symbol"], d["exchange"], d["interval"])
            item = self.tree_items.get(key, None)

            if not item:
                item = QtWidgets.QTreeWidgetItem()
                self.tree_items[key] = item

                item.setText(1, ".".join([d["symbol"], d["exchange"]]))
                item.setText(2, d["symbol"])
                item.setText(3, d["exchange"])

                if d["interval"] == Interval.MINUTE.value:
                    self.minute_child.addChild(item)
                elif d["interval"] == Interval.HOUR.value:
                    self.hour_child.addChild(item)
                else:
                    self.daily_child.addChild(item)

                output_button = QtWidgets.QPushButton("导出")
                output_func = partial(
                    self.output_data,
                    d["symbol"],
                    Exchange(d["exchange"]),
                    Interval(d["interval"]),
                    d["start"],
                    d["end"]
                )
                output_button.clicked.connect(output_func)

                show_button = QtWidgets.QPushButton("查看")
                show_func = partial(
                    self.show_data,
                    d["symbol"],
                    Exchange(d["exchange"]),
                    Interval(d["interval"]),
                    d["start"],
                    d["end"]
                )
                show_button.clicked.connect(show_func)

                delete_button = QtWidgets.QPushButton("删除")
                delete_func = partial(
                    self.delete_data,
                    d["symbol"],
                    Exchange(d["exchange"]),
                    Interval(d["interval"]),
                )
                delete_button.clicked.connect(delete_func)

                self.tree.setItemWidget(item, 7, show_button)
                self.tree.setItemWidget(item, 8, output_button)
                self.tree.setItemWidget(item, 9, delete_button)

            item.setText(4, str(d["count"]))
            item.setText(5, d["start"].strftime("%Y-%m-%d %H:%M:%S"))
            item.setText(6, d["end"].strftime("%Y-%m-%d %H:%M:%S"))

        self.minute_child.setExpanded(True)
        self.hour_child.setExpanded(True)
        self.daily_child.setExpanded(True)
コード例 #14
0
ファイル: widget.py プロジェクト: GreatYoungShaw/vnpy
    def init_ui(self):
        """"""
        self.setWindowTitle("启动算法")
        self.setFrameShape(self.Box)
        self.setLineWidth(1)

        self.name_line = QtWidgets.QLineEdit()

        self.direction_combo = QtWidgets.QComboBox()
        self.direction_combo.addItems(
            [Direction.LONG.value, Direction.SHORT.value])

        float_validator = QtGui.QDoubleValidator()

        self.price_line = QtWidgets.QLineEdit()
        self.price_line.setValidator(float_validator)

        self.volume_line = QtWidgets.QLineEdit()
        self.volume_line.setValidator(float_validator)

        int_validator = QtGui.QIntValidator()

        self.payup_line = QtWidgets.QLineEdit()
        self.payup_line.setValidator(int_validator)

        self.interval_line = QtWidgets.QLineEdit()
        self.interval_line.setValidator(int_validator)

        button_start = QtWidgets.QPushButton("启动")
        button_start.clicked.connect(self.start_algo)

        self.lock_combo = QtWidgets.QComboBox()
        self.lock_combo.addItems(["否", "是"])

        self.class_combo = QtWidgets.QComboBox()

        add_button = QtWidgets.QPushButton("添加策略")
        add_button.clicked.connect(self.add_strategy)

        init_button = QtWidgets.QPushButton("全部初始化")
        init_button.clicked.connect(self.strategy_engine.init_all_strategies)

        start_button = QtWidgets.QPushButton("全部启动")
        start_button.clicked.connect(self.strategy_engine.start_all_strategies)

        stop_button = QtWidgets.QPushButton("全部停止")
        stop_button.clicked.connect(self.strategy_engine.stop_all_strategies)

        add_spread_button = QtWidgets.QPushButton("创建价差")
        add_spread_button.clicked.connect(self.add_spread)

        remove_spread_button = QtWidgets.QPushButton("移除价差")
        remove_spread_button.clicked.connect(self.remove_spread)

        form = QtWidgets.QFormLayout()
        form.addRow("价差", self.name_line)
        form.addRow("方向", self.direction_combo)
        form.addRow("价格", self.price_line)
        form.addRow("数量", self.volume_line)
        form.addRow("超价", self.payup_line)
        form.addRow("间隔", self.interval_line)
        form.addRow("锁仓", self.lock_combo)
        form.addRow(button_start)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form)
        vbox.addStretch()
        vbox.addWidget(self.class_combo)
        vbox.addWidget(add_button)
        vbox.addWidget(init_button)
        vbox.addWidget(start_button)
        vbox.addWidget(stop_button)
        vbox.addStretch()
        vbox.addWidget(add_spread_button)
        vbox.addWidget(remove_spread_button)

        self.setLayout(vbox)
コード例 #15
0
ファイル: widget.py プロジェクト: edword01/vnpy
    def init_ui(self):
        """"""
        self.setWindowTitle("算法交易")

        # Left side control widgets
        self.template_combo = QtWidgets.QComboBox()
        self.template_combo.currentIndexChanged.connect(self.show_algo_widget)

        form = QtWidgets.QFormLayout()
        form.addRow("算法", self.template_combo)
        widget = QtWidgets.QWidget()
        widget.setLayout(form)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(widget)

        for algo_template in self.algo_engine.algo_templates.values():
            widget = AlgoWidget(self.algo_engine, algo_template)
            vbox.addWidget(widget)

            template_name = algo_template.__name__
            display_name = algo_template.display_name

            self.algo_widgets[template_name] = widget
            self.template_combo.addItem(display_name, template_name)

        vbox.addStretch()

        stop_all_button = QtWidgets.QPushButton("全部停止")
        stop_all_button.setFixedHeight(stop_all_button.sizeHint().height() * 2)
        stop_all_button.clicked.connect(self.algo_engine.stop_all)

        vbox.addWidget(stop_all_button)

        # Right side monitor widgets
        active_algo_monitor = ActiveAlgoMonitor(self.algo_engine,
                                                self.event_engine)
        inactive_algo_monitor = InactiveAlgoMonitor(self.algo_engine,
                                                    self.event_engine)
        tab1 = QtWidgets.QTabWidget()
        tab1.addTab(active_algo_monitor, "执行中")
        tab1.addTab(inactive_algo_monitor, "已结束")

        log_monitor = LogMonitor(self.event_engine)
        tab2 = QtWidgets.QTabWidget()
        tab2.addTab(log_monitor, "日志")

        setting_monitor = SettingMonitor(self.algo_engine, self.event_engine)
        setting_monitor.use_signal.connect(self.use_setting)
        tab3 = QtWidgets.QTabWidget()
        tab3.addTab(setting_monitor, "配置")

        grid = QtWidgets.QGridLayout()
        grid.addWidget(tab1, 0, 0, 1, 2)
        grid.addWidget(tab2, 1, 0)
        grid.addWidget(tab3, 1, 1)

        hbox2 = QtWidgets.QHBoxLayout()
        hbox2.addLayout(vbox)
        hbox2.addLayout(grid)
        self.setLayout(hbox2)

        self.show_algo_widget()
コード例 #16
0
    def init_ui(self):
        """"""
        self.setWindowTitle("创建价差")

        self.name_line = QtWidgets.QLineEdit()
        self.active_line = QtWidgets.QLineEdit()

        self.min_volume_combo = QtWidgets.QComboBox()
        self.min_volume_combo.addItems([
            "1",
            "0.1",
            "0.01",
            "0.001",
            "0.0001",
            "0.00001",
            "0.000001",
        ])

        self.formula_line = QtWidgets.QLineEdit()

        self.grid = QtWidgets.QGridLayout()

        button_add = QtWidgets.QPushButton("创建价差")
        button_add.clicked.connect(self.add_spread)

        Label = QtWidgets.QLabel

        grid = QtWidgets.QGridLayout()
        grid.addWidget(Label("价差名称"), 0, 0)
        grid.addWidget(self.name_line, 0, 1, 1, 4)
        grid.addWidget(Label("主动腿代码"), 1, 0)
        grid.addWidget(self.active_line, 1, 1, 1, 4)
        grid.addWidget(Label("最小交易量"), 2, 0)
        grid.addWidget(self.min_volume_combo, 2, 1, 1, 4)
        grid.addWidget(Label("价格公式"), 3, 0)
        grid.addWidget(self.formula_line, 3, 1, 1, 4)

        grid.addWidget(Label("合约代码"), 4, 1)
        grid.addWidget(Label("交易方向"), 4, 2)
        grid.addWidget(Label("交易乘数"), 4, 3)
        grid.addWidget(Label("合约模式"), 4, 4)

        int_validator = QtGui.QIntValidator()
        int_validator.setBottom(0)

        leg_count = 5
        variables = ["A", "B", "C", "D", "E"]
        for i, variable in enumerate(variables):
            symbol_line = QtWidgets.QLineEdit()

            direction_combo = QtWidgets.QComboBox()
            direction_combo.addItems(["买入", "卖出"])

            trading_line = QtWidgets.QLineEdit()
            trading_line.setValidator(int_validator)

            inverse_combo = QtWidgets.QComboBox()
            inverse_combo.addItems(["正向", "反向"])

            grid.addWidget(Label(variable), 5 + i, 0)
            grid.addWidget(symbol_line, 5 + i, 1)
            grid.addWidget(direction_combo, 5 + i, 2)
            grid.addWidget(trading_line, 5 + i, 3)
            grid.addWidget(inverse_combo, 5 + i, 4)

            d = {
                "variable": variable,
                "symbol": symbol_line,
                "direction": direction_combo,
                "trading": trading_line,
                "inverse": inverse_combo
            }
            self.leg_widgets.append(d)

        grid.addWidget(
            Label(""),
            5 + leg_count,
            0,
        )
        grid.addWidget(button_add, 6 + leg_count, 0, 1, 5)

        self.setLayout(grid)
コード例 #17
0
    def init_ui(self):
        """"""
        self.setWindowTitle("创建价差")

        self.name_line = QtWidgets.QLineEdit()
        self.active_line = QtWidgets.QLineEdit()

        self.min_volume_combo = QtWidgets.QComboBox()
        self.min_volume_combo.addItems([
            "1",
            "0.1",
            "0.01",
            "0.001",
            "0.0001",
            "0.00001",
            "0.000001",
        ])

        self.grid = QtWidgets.QGridLayout()

        button_add = QtWidgets.QPushButton("创建价差")
        button_add.clicked.connect(self.add_spread)

        Label = QtWidgets.QLabel

        grid = QtWidgets.QGridLayout()
        grid.addWidget(Label("价差名称"), 0, 0)
        grid.addWidget(self.name_line, 0, 1, 1, 4)
        grid.addWidget(Label("主动腿代码"), 1, 0)
        grid.addWidget(self.active_line, 1, 1, 1, 4)
        grid.addWidget(Label("最小交易量"), 2, 0)
        grid.addWidget(self.min_volume_combo, 2, 1, 1, 4)

        grid.addWidget(Label(""), 3, 0)
        grid.addWidget(Label("本地代码"), 4, 1)
        grid.addWidget(Label("价格乘数"), 4, 2)
        grid.addWidget(Label("交易乘数"), 4, 3)
        grid.addWidget(Label("合约模式"), 4, 4)

        int_validator = QtGui.QIntValidator()
        double_validator = QtGui.QDoubleValidator()

        leg_count = 5
        for i in range(leg_count):
            symbol_line = QtWidgets.QLineEdit()

            price_line = QtWidgets.QLineEdit()
            price_line.setValidator(double_validator)

            trading_line = QtWidgets.QLineEdit()
            trading_line.setValidator(int_validator)

            inverse_combo = QtWidgets.QComboBox()
            inverse_combo.addItems(["正向", "反向"])

            grid.addWidget(Label("腿{}".format(i + 1)), 5 + i, 0)
            grid.addWidget(symbol_line, 5 + i, 1)
            grid.addWidget(price_line, 5 + i, 2)
            grid.addWidget(trading_line, 5 + i, 3)
            grid.addWidget(inverse_combo, 5 + i, 4)

            d = {
                "symbol": symbol_line,
                "price": price_line,
                "trading": trading_line,
                "inverse": inverse_combo
            }
            self.leg_widgets.append(d)

        grid.addWidget(
            Label(""),
            5 + leg_count,
            0,
        )
        grid.addWidget(button_add, 6 + leg_count, 0, 1, 5)

        self.setLayout(grid)
コード例 #18
0
    def init_ui(self):
        """"""
        self.setWindowTitle("行情记录")
        self.resize(1000, 600)

        # Create widgets
        self.symbol_line = QtWidgets.QLineEdit()
        self.symbol_line.setFixedHeight(self.symbol_line.sizeHint().height() *
                                        2)

        contracts = self.main_engine.get_all_contracts()
        self.vt_symbols = [contract.vt_symbol for contract in contracts]

        self.symbol_completer = QtWidgets.QCompleter(self.vt_symbols)
        self.symbol_completer.setFilterMode(QtCore.Qt.MatchContains)
        self.symbol_completer.setCompletionMode(
            self.symbol_completer.PopupCompletion)
        self.symbol_line.setCompleter(self.symbol_completer)

        add_bar_button = QtWidgets.QPushButton("添加")
        add_bar_button.clicked.connect(self.add_bar_recording)

        remove_bar_button = QtWidgets.QPushButton("移除")
        remove_bar_button.clicked.connect(self.remove_bar_recording)

        add_tick_button = QtWidgets.QPushButton("添加")
        add_tick_button.clicked.connect(self.add_tick_recording)

        remove_tick_button = QtWidgets.QPushButton("移除")
        remove_tick_button.clicked.connect(self.remove_tick_recording)

        self.bar_recording_edit = QtWidgets.QTextEdit()
        self.bar_recording_edit.setReadOnly(True)

        self.tick_recording_edit = QtWidgets.QTextEdit()
        self.tick_recording_edit.setReadOnly(True)

        self.log_edit = QtWidgets.QTextEdit()
        self.log_edit.setReadOnly(True)

        # Set layout
        grid = QtWidgets.QGridLayout()
        grid.addWidget(QtWidgets.QLabel("K线记录"), 0, 0)
        grid.addWidget(add_bar_button, 0, 1)
        grid.addWidget(remove_bar_button, 0, 2)
        grid.addWidget(QtWidgets.QLabel("Tick记录"), 1, 0)
        grid.addWidget(add_tick_button, 1, 1)
        grid.addWidget(remove_tick_button, 1, 2)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(QtWidgets.QLabel("本地代码"))
        hbox.addWidget(self.symbol_line)
        hbox.addWidget(QtWidgets.QLabel("     "))
        hbox.addLayout(grid)
        hbox.addStretch()

        grid2 = QtWidgets.QGridLayout()
        grid2.addWidget(QtWidgets.QLabel("K线记录列表"), 0, 0)
        grid2.addWidget(QtWidgets.QLabel("Tick记录列表"), 0, 1)
        grid2.addWidget(self.bar_recording_edit, 1, 0)
        grid2.addWidget(self.tick_recording_edit, 1, 1)
        grid2.addWidget(self.log_edit, 2, 0, 1, 2)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox)
        vbox.addLayout(grid2)
        self.setLayout(vbox)
コード例 #19
0
ファイル: widget.py プロジェクト: ajmal017/jonpy
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle(f"{self.portfolio_name}组合配置")

        portfolio_setting = self.option_engine.get_portfolio_setting(
            self.portfolio_name)

        form = QtWidgets.QFormLayout()

        # Model Combo
        self.model_name_combo = QtWidgets.QComboBox()
        self.model_name_combo.addItems(list(PRICING_MODELS.keys()))

        model_name = portfolio_setting.get("model_name", "")
        if model_name:
            self.model_name_combo.setCurrentIndex(
                self.model_name_combo.findText(model_name))

        form.addRow("模型", self.model_name_combo)

        # Interest rate spin
        self.interest_rate_spin = QtWidgets.QDoubleSpinBox()
        self.interest_rate_spin.setMinimum(0)
        self.interest_rate_spin.setMaximum(20)
        self.interest_rate_spin.setDecimals(1)
        self.interest_rate_spin.setSuffix("%")

        interest_rate = portfolio_setting.get("interest_rate", 0.02)
        self.interest_rate_spin.setValue(interest_rate * 100)

        form.addRow("利率", self.interest_rate_spin)

        # Inverse combo
        self.inverse_combo = QtWidgets.QComboBox()
        self.inverse_combo.addItems(["正向", "反向"])

        inverse = portfolio_setting.get("inverse", False)
        if inverse:
            self.inverse_combo.setCurrentIndex(1)
        else:
            self.inverse_combo.setCurrentIndex(0)

        form.addRow("合约", self.inverse_combo)

        # Underlying for each chain
        self.combos: Dict[str, QtWidgets.QComboBox] = {}

        portfolio = self.option_engine.get_portfolio(self.portfolio_name)
        underlying_symbols = self.option_engine.get_underlying_symbols(
            self.portfolio_name)

        chain_symbols = list(portfolio._chains.keys())
        chain_symbols.sort()

        chain_underlying_map = portfolio_setting.get("chain_underlying_map",
                                                     {})

        for chain_symbol in chain_symbols:
            combo = QtWidgets.QComboBox()
            combo.addItem("")
            combo.addItems(underlying_symbols)

            underlying_symbol = chain_underlying_map.get(chain_symbol, "")
            if underlying_symbol:
                combo.setCurrentIndex(combo.findText(underlying_symbol))

            form.addRow(chain_symbol, combo)
            self.combos[chain_symbol] = combo

        # Set layout
        button = QtWidgets.QPushButton("确定")
        button.clicked.connect(self.update_portfolio_setting)
        form.addRow(button)

        self.setLayout(form)
コード例 #20
0
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("期权电子眼")

        self.algo_monitor = ElectronicEyeMonitor(self.option_engine,
                                                 self.portfolio_name)

        self.log_monitor = QtWidgets.QTextEdit()
        self.log_monitor.setReadOnly(True)
        self.log_monitor.setMaximumWidth(400)

        stop_pricing_button = QtWidgets.QPushButton("停止定价")
        stop_pricing_button.clicked.connect(self.stop_pricing_for_all)

        stop_trading_button = QtWidgets.QPushButton("停止交易")
        stop_trading_button.clicked.connect(self.stop_trading_for_all)

        self.price_spread_spin = AlgoDoubleSpinBox()
        self.volatility_spread_spin = AlgoDoubleSpinBox()
        self.direction_combo = AlgoDirectionCombo()
        self.max_order_size_spin = AlgoPositiveSpinBox()
        self.target_pos_spin = AlgoSpinBox()
        self.max_pos_spin = AlgoPositiveSpinBox()

        price_spread_button = QtWidgets.QPushButton("设置")
        price_spread_button.clicked.connect(self.set_price_spread_for_all)

        volatility_spread_button = QtWidgets.QPushButton("设置")
        volatility_spread_button.clicked.connect(
            self.set_volatility_spread_for_all)

        direction_button = QtWidgets.QPushButton("设置")
        direction_button.clicked.connect(self.set_direction_for_all)

        max_order_size_button = QtWidgets.QPushButton("设置")
        max_order_size_button.clicked.connect(self.set_max_order_size_for_all)

        target_pos_button = QtWidgets.QPushButton("设置")
        target_pos_button.clicked.connect(self.set_target_pos_for_all)

        max_pos_button = QtWidgets.QPushButton("设置")
        max_pos_button.clicked.connect(self.set_max_pos_for_all)

        QLabel = QtWidgets.QLabel
        grid = QtWidgets.QGridLayout()
        grid.addWidget(QLabel("价格价差"), 0, 0)
        grid.addWidget(self.price_spread_spin, 0, 1)
        grid.addWidget(price_spread_button, 0, 2)
        grid.addWidget(QLabel("隐波价差"), 1, 0)
        grid.addWidget(self.volatility_spread_spin, 1, 1)
        grid.addWidget(volatility_spread_button, 1, 2)
        grid.addWidget(QLabel("持仓上限"), 2, 0)
        grid.addWidget(self.max_pos_spin, 2, 1)
        grid.addWidget(max_pos_button, 2, 2)
        grid.addWidget(QLabel("目标持仓"), 3, 0)
        grid.addWidget(self.target_pos_spin, 3, 1)
        grid.addWidget(target_pos_button, 3, 2)
        grid.addWidget(QLabel("最大委托"), 4, 0)
        grid.addWidget(self.max_order_size_spin, 4, 1)
        grid.addWidget(max_order_size_button, 4, 2)
        grid.addWidget(QLabel("方向"), 5, 0)
        grid.addWidget(self.direction_combo, 5, 1)
        grid.addWidget(direction_button, 5, 2)

        hbox1 = QtWidgets.QHBoxLayout()
        hbox1.addWidget(stop_pricing_button)
        hbox1.addWidget(stop_trading_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox1)
        vbox.addLayout(grid)
        vbox.addWidget(self.log_monitor)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(self.algo_monitor)
        hbox.addLayout(vbox)

        self.setLayout(hbox)
コード例 #21
0
ファイル: widget.py プロジェクト: systemtrader/vnpy_mod
    def init_ui(self):
        self.setWindowTitle("同步合约设置")
        self.setMinimumWidth(300)

        self.symbol_combo = ComboBox()
        self.symbol_combo.pop_show.connect(self.refresh_symbol_list)
        self.symbol_combo.activated[str].connect(self.set_removed_symbol)
        self.refresh_symbol_list()

        self.intra_combo = ComboBox()
        self.intra_combo.pop_show.connect(self.refresh_intra_list)
        self.intra_combo.activated[str].connect(self.set_removed_com)
        self.refresh_intra_list()

        self.order_vol_combo = ComboBox()
        self.order_vol_combo.pop_show.connect(self.refresh_order_vol_white_list)
        self.order_vol_combo.activated[str].connect(self.set_removed_order_vol)
        self.refresh_order_vol_white_list()

        self.filter_vol_combo = QtWidgets.QComboBox()
        self.filter_vol_combo.addItems(['是', '否'])
        self.filter_vol_combo.activated[str].connect(self.set_is_filter_vol)
        self.get_current_filter_vol()

        validator = QtGui.QIntValidator()
        self.new_remove_line = QtWidgets.QLineEdit()
        self.new_intra_line = QtWidgets.QLineEdit()
        
        self.new_order_vol_line = QtWidgets.QLineEdit()
        self.new_order_vol_line.setValidator(validator)

        button_add = QtWidgets.QPushButton("添加禁止同步")
        button_add.clicked.connect(self.add)

        button_remove = QtWidgets.QPushButton("移除禁止同步")
        button_remove.clicked.connect(self.remove)

        button_add_com = QtWidgets.QPushButton("添加日内品种")
        button_add_com.clicked.connect(self.add_com)

        button_remove_com = QtWidgets.QPushButton("移除日内品种")
        button_remove_com.clicked.connect(self.remove_com)

        button_add_order_volume = QtWidgets.QPushButton("添加委托手数")
        button_add_order_volume.clicked.connect(self.add_order_volume)

        button_remove_order_volume = QtWidgets.QPushButton("移除委托手数")
        button_remove_order_volume.clicked.connect(self.remove_order_volume)

        big_btns = [
            button_add, button_remove,
            button_add_com, button_remove_com,
            button_add_order_volume, button_remove_order_volume
        ]

        for btn in big_btns:
            btn.setFixedHeight(btn.sizeHint().height() * 1)

        save_setting_button = QtWidgets.QPushButton("保存设置")
        save_setting_button.clicked.connect(self.save_setting)
        save_setting_button.setFixedHeight(save_setting_button.sizeHint().height() * 1.5)

        form = QtWidgets.QFormLayout()
        form.addRow("禁止同步合约", self.symbol_combo)
        form.addRow("添加新合约", self.new_remove_line)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(button_add)
        hbox.addWidget(button_remove)

        form_com = QtWidgets.QFormLayout()
        form_com.addRow("日内模式品种", self.intra_combo)
        form_com.addRow("添加新品种", self.new_intra_line)

        hbox_com = QtWidgets.QHBoxLayout()
        hbox_com.addWidget(button_add_com)
        hbox_com.addWidget(button_remove_com)

        form_order_vol = QtWidgets.QFormLayout()
        form_order_vol.addRow("是否过滤委托手数", self.filter_vol_combo)
        form_order_vol.addRow("允许跟单委托手数", self.order_vol_combo)
        form_order_vol.addRow("添加新手数", self.new_order_vol_line)

        hbox_order_vol = QtWidgets.QHBoxLayout()
        hbox_order_vol.addWidget(button_add_order_volume)
        hbox_order_vol.addWidget(button_remove_order_volume)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form)
        vbox.addLayout(hbox)
        vbox.addLayout(form_com)
        vbox.addLayout(hbox_com)
        vbox.addLayout(form_order_vol)
        vbox.addLayout(hbox_order_vol)

        vbox.addWidget(save_setting_button)

        self.setLayout(vbox)
コード例 #22
0
ファイル: widget.py プロジェクト: systemtrader/vnpy_mod
    def init_ui(self):
        self.setWindowTitle("委托设置")
        self.setMinimumWidth(300)

        self.order_type_combo = QtWidgets.QComboBox()
        self.order_type_combo.addItems(['限价', '市价'])
        self.order_type_combo.activated[str].connect(self.set_order_type)
        self.get_current_order_type()

        self.chase_base_price_combo = QtWidgets.QComboBox()
        self.chase_base_price_combo.addItems(['对手价', '挂单价'])
        self.chase_base_price_combo.activated[str].connect(self.set_chase_base_price)
        self.get_current_chase_base_price()

        self.chase_combo = QtWidgets.QComboBox()
        self.chase_combo.addItems(['是', '否'])
        self.chase_combo.activated[str].connect(self.set_is_chase)
        self.get_current_chase()

        self.chase_base_last_order_combo = QtWidgets.QComboBox()
        self.chase_base_last_order_combo.addItems(['是', '否'])
        self.chase_base_last_order_combo.activated[str].connect(self.set_chase_base_last)
        self.chase_base_last_order_combo.currentIndexChanged[int].connect(self.change_base_price_editable)
        self.get_current_chase_base_last()

        validator = QtGui.QIntValidator()
        self.chase_timeout_line = QtWidgets.QLineEdit(str(self.follow_engine.chase_order_timeout))
        self.chase_timeout_line.setValidator(validator)
        self.chase_timeout_line.editingFinished.connect(self.set_chase_order_timeout)

        self.chase_tickadd_line = QtWidgets.QLineEdit(str(self.follow_engine.chase_order_tick_add))
        self.chase_tickadd_line.setValidator(validator)
        self.chase_tickadd_line.editingFinished.connect(self.set_chase_order_tickadd)

        self.chase_resend_line = QtWidgets.QLineEdit(str(self.follow_engine.chase_max_resend))
        self.chase_resend_line.setValidator(validator)
        self.chase_resend_line.editingFinished.connect(self.set_chase_max_resend)

        self.timeout_line = QtWidgets.QLineEdit(str(self.follow_engine.cancel_order_timeout))
        self.timeout_line.setValidator(validator)
        self.timeout_line.editingFinished.connect(self.set_cancel_order_timeout)

        self.tickout_line = QtWidgets.QLineEdit(str(self.follow_engine.tick_add))
        self.tickout_line.setValidator(validator)
        self.tickout_line.editingFinished.connect(self.set_tick_add)

        self.mustdone_tickout_line = QtWidgets.QLineEdit(str(self.follow_engine.must_done_tick_add))
        self.mustdone_tickout_line.setValidator(validator)
        self.mustdone_tickout_line.editingFinished.connect(self.set_must_done_tick_add)

        self.single_max_line = QtWidgets.QLineEdit(str(self.follow_engine.single_max))
        self.single_max_line.setValidator(validator)
        self.single_max_line.editingFinished.connect(self.set_single_max)

        self.save_setting_button = QtWidgets.QPushButton("保存设置")
        self.save_setting_button.clicked.connect(self.save_setting)
        self.save_setting_button.setFixedHeight(self.save_setting_button.sizeHint().height() * 1.5)

        form = QtWidgets.QFormLayout()
        form.addRow("发单类型", self.order_type_combo)
        form.addRow("超时撤单(秒)", self.timeout_line)
        form.addRow("小超价档位", self.tickout_line)
        form.addRow("大超价档位", self.mustdone_tickout_line)
        form.addRow("单笔最大手数", self.single_max_line)
        form.addRow("是否追单", self.chase_combo)
        form.addRow("是否基于上笔委托追单", self.chase_base_last_order_combo)
        form.addRow("追单基础价(不指定)", self.chase_base_price_combo)
        form.addRow("追单超时", self.chase_timeout_line)
        form.addRow("追单超价", self.chase_tickadd_line)
        form.addRow("最大追单次数", self.chase_resend_line)
        form.addRow(self.save_setting_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form)

        self.setLayout(vbox)
コード例 #23
0
ファイル: widget.py プロジェクト: systemtrader/vnpy_mod
    def init_ui(self):
        """"""
        self.setWindowTitle(f"跟随交易 [{TRADER_DIR}]")
        self.setMinimumSize(920, 750)
        self.setMaximumSize(1920, 1080)

        # create widgets
        self.start_button = QtWidgets.QPushButton("启动")
        self.start_button.clicked.connect(self.start_follow)

        self.stop_button = QtWidgets.QPushButton("停止")
        self.stop_button.clicked.connect(self.stop_follow)
        self.stop_button.setEnabled(False)

        self.sync_pos_button = QtWidgets.QPushButton("同步持仓")
        self.sync_pos_button.clicked.connect(self.sync_pos)
        self.sync_pos_button.setEnabled(False)

        self.modify_pos_button = QtWidgets.QPushButton("修改仓位")
        self.modify_pos_button.clicked.connect(self.manual_modify_pos)

        self.set_skip_button = QtWidgets.QPushButton("同步设置")
        self.set_skip_button.clicked.connect(self.set_skip_contracts)

        self.set_order_button = QtWidgets.QPushButton("委托设置")
        self.set_order_button.clicked.connect(self.set_order_setting)

        self.close_hedged_pos_button = QtWidgets.QPushButton("锁仓单平仓")
        self.close_hedged_pos_button.clicked.connect(self.close_hedged_pos)
        self.close_hedged_pos_button.setEnabled(False)

        for btn in [self.start_button,
                    self.stop_button,
                    self.sync_pos_button,
                    self.modify_pos_button,
                    self.set_skip_button,
                    self.set_order_button,
                    self.close_hedged_pos_button]:
            btn.setFixedHeight(btn.sizeHint().height() * 2)

        gateways = self.follow_engine.get_connected_gateway_names()
        if len(gateways) == 2:
            self.is_gateway_inited = True

        self.source_combo = ComboBox()
        self.source_combo.addItems(gateways)
        self.source_combo.pop_show.connect(self.refresh_gateway_name)
        self.target_combo = ComboBox()
        self.target_combo.addItems(gateways)
        self.target_combo.pop_show.connect(self.refresh_gateway_name)

        self.skip_contracts_combo = ComboBox()
        self.skip_contracts_combo.pop_show.connect(self.refresh_skip_contracts)
        self.refresh_skip_contracts()

        self.intraday_combo = ComboBox()
        self.intraday_combo.pop_show.connect(self.refresh_intraday)
        self.refresh_intraday()

        self.order_vol_combo = ComboBox()
        self.order_vol_combo.pop_show.connect(self.refresh_order_vols)
        self.refresh_order_vols()

        self.follow_direction_combo = QtWidgets.QComboBox()
        self.follow_direction_combo.addItems(['正向跟随', '反向跟随'])
        self.follow_direction_combo.activated[str].connect(self.set_follow_direction)
        self.get_current_follow_direction()
        self.follow_direction_combo.setEnabled(False)

        self.intraday_trading_combo = QtWidgets.QComboBox()
        self.intraday_trading_combo.addItems(['是', '否'])
        self.intraday_trading_combo.activated[str].connect(self.set_is_intraday_trading)
        self.get_current_intraday_trading()

        validator = QtGui.QIntValidator()

        self.follow_timeout_line = QtWidgets.QLineEdit(str(self.follow_engine.filter_trade_timeout))
        self.follow_timeout_line.setValidator(validator)
        self.follow_timeout_line.editingFinished.connect(self.set_follow_timeout)

        self.multiples_line = QtWidgets.QLineEdit(str(self.follow_engine.multiples))
        self.multiples_line.setValidator(validator)
        self.multiples_line.editingFinished.connect(self.set_multiples)

        self.pos_delta_monitor = PosDeltaMonitor(self.main_engine, self.event_engine)
        self.log_monitor = LogMonitor(self.main_engine, self.event_engine)

        # Set layout
        form = QtWidgets.QFormLayout()
        form.addRow("标准户接口", self.source_combo)
        form.addRow("跟单户接口", self.target_combo)
        form.addRow("跟单方向", self.follow_direction_combo)
        form.addRow("超时禁跟(秒)", self.follow_timeout_line)
        form.addRow("跟随倍数", self.multiples_line)
        form.addRow("是否日内交易", self.intraday_trading_combo)
        form.addRow(self.start_button)
        form.addRow(self.stop_button)

        form_action = QtWidgets.QFormLayout()
        form_action.addRow("日内模式品种", self.intraday_combo)
        form_action.addRow("禁止同步合约", self.skip_contracts_combo)
        form_action.addRow("跟单委托手数", self.order_vol_combo)
        form_action.addRow(self.modify_pos_button)
        form_action.addRow(self.set_skip_button)
        form_action.addRow(self.set_order_button)
        form_action.addRow(self.sync_pos_button)
        form_action.addRow(self.close_hedged_pos_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form)
        vbox.addStretch()
        vbox.addLayout(form_action)
        vbox.addStretch()

        grid = QtWidgets.QGridLayout()
        grid.addLayout(vbox, 0, 0, 2, 1)
        grid.addWidget(self.pos_delta_monitor, 0, 1)
        grid.addWidget(self.log_monitor, 1, 1)
        grid.setColumnStretch(0, 1)
        grid.setColumnStretch(1, 3)

        self.setLayout(grid)
コード例 #24
0
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("波动率管理")

        tab = QtWidgets.QTabWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(tab)
        self.setLayout(vbox)

        self.chain_symbols = list(self.portfolio.chains.keys())
        self.chain_symbols.sort()

        for chain_symbol in self.chain_symbols:
            chain = self.portfolio.get_chain(chain_symbol)

            table = QtWidgets.QTableWidget()
            table.setEditTriggers(table.NoEditTriggers)
            table.verticalHeader().setVisible(False)
            table.setColumnCount(4)
            table.setRowCount(len(chain.indexes))
            table.setHorizontalHeaderLabels(["行权价", "中值隐波", "定价隐波", "执行拟合"])
            table.horizontalHeader().setSectionResizeMode(
                QtWidgets.QHeaderView.Stretch)

            for row, index in enumerate(chain.indexes):
                index_cell = IndexCell(index)
                mid_impv_cell = MonitorCell("")

                set_func = partial(self.set_pricing_impv,
                                   chain_symbol=chain_symbol,
                                   index=index)
                pricing_impv_spin = VolatilityDoubleSpinBox()
                pricing_impv_spin.setAlignment(QtCore.Qt.AlignCenter)
                pricing_impv_spin.valueChanged.connect(set_func)

                check = QtWidgets.QCheckBox()

                check_hbox = QtWidgets.QHBoxLayout()
                check_hbox.setAlignment(QtCore.Qt.AlignCenter)
                check_hbox.addWidget(check)

                check_widget = QtWidgets.QWidget()
                check_widget.setLayout(check_hbox)

                table.setItem(row, 0, index_cell)
                table.setItem(row, 1, mid_impv_cell)
                table.setCellWidget(row, 2, pricing_impv_spin)
                table.setCellWidget(row, 3, check_widget)

                cells = {
                    "mid_impv": mid_impv_cell,
                    "pricing_impv": pricing_impv_spin,
                    "check": check
                }

                self.cells[(chain_symbol, index)] = cells

            reset_func = partial(self.reset_pricing_impv,
                                 chain_symbol=chain_symbol)
            button_reset = QtWidgets.QPushButton("重置")
            button_reset.clicked.connect(reset_func)

            fit_func = partial(self.fit_pricing_impv,
                               chain_symbol=chain_symbol)
            button_fit = QtWidgets.QPushButton("拟合")
            button_fit.clicked.connect(fit_func)

            increase_func = partial(self.increase_pricing_impv,
                                    chain_symbol=chain_symbol)
            button_increase = QtWidgets.QPushButton("+0.1%")
            button_increase.clicked.connect(increase_func)

            decrease_func = partial(self.decrease_pricing_impv,
                                    chain_symbol=chain_symbol)
            button_decrease = QtWidgets.QPushButton("-0.1%")
            button_decrease.clicked.connect(decrease_func)

            hbox = QtWidgets.QHBoxLayout()
            hbox.addWidget(button_reset)
            hbox.addWidget(button_fit)
            hbox.addWidget(button_increase)
            hbox.addWidget(button_decrease)

            vbox = QtWidgets.QVBoxLayout()
            vbox.addLayout(hbox)
            vbox.addWidget(table)

            chain_widget = QtWidgets.QWidget()
            chain_widget.setLayout(vbox)
            tab.addTab(chain_widget, chain_symbol)

            self.update_pricing_impv(chain_symbol)

            self.default_foreground = mid_impv_cell.foreground()
            self.default_background = mid_impv_cell.background()

            table.resizeRowsToContents()
コード例 #25
0
    def init_ui(self):
        """"""
        QLabel = QtWidgets.QLabel

        self.target_combo = QtWidgets.QComboBox()
        self.target_combo.addItems(list(self.DISPLAY_NAME_MAP.keys()))

        grid = QtWidgets.QGridLayout()
        grid.addWidget(QLabel("目标"), 0, 0)
        grid.addWidget(self.target_combo, 0, 1, 1, 3)
        grid.addWidget(QLabel("参数"), 1, 0)
        grid.addWidget(QLabel("开始"), 1, 1)
        grid.addWidget(QLabel("步进"), 1, 2)
        grid.addWidget(QLabel("结束"), 1, 3)

        # Add vt_symbol and name edit if add new strategy
        self.setWindowTitle(f"优化参数配置:{self.class_name}")

        validator = QtGui.QDoubleValidator()
        row = 2

        for name, value in self.parameters.items():
            type_ = type(value)
            if type_ not in [int, float]:
                continue

            start_edit = QtWidgets.QLineEdit(str(value))
            step_edit = QtWidgets.QLineEdit(str(1))
            end_edit = QtWidgets.QLineEdit(str(value))

            for edit in [start_edit, step_edit, end_edit]:
                edit.setValidator(validator)

            grid.addWidget(QLabel(name), row, 0)
            grid.addWidget(start_edit, row, 1)
            grid.addWidget(step_edit, row, 2)
            grid.addWidget(end_edit, row, 3)

            self.edits[name] = {
                "type": type_,
                "start": start_edit,
                "step": step_edit,
                "end": end_edit
            }

            row += 1

        parallel_button = QtWidgets.QPushButton("多进程优化")
        parallel_button.clicked.connect(self.generate_parallel_setting)
        grid.addWidget(parallel_button, row, 0, 1, 4)

        row += 1
        ga_button = QtWidgets.QPushButton("遗传算法优化")
        ga_button.clicked.connect(self.generate_ga_setting)
        grid.addWidget(ga_button, row, 0, 1, 4)

        widget = QtWidgets.QWidget()
        widget.setLayout(grid)

        scroll = QtWidgets.QScrollArea()
        scroll.setWidgetResizable(True)
        scroll.setWidget(widget)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(scroll)
        self.setLayout(vbox)
コード例 #26
0
ファイル: widget.py プロジェクト: h1222443/vnpy
    def init_ui(self):
        """"""
        self.setWindowTitle("CTA策略")

        # Create widgets
        self.class_combo = QtWidgets.QComboBox()

        add_button = QtWidgets.QPushButton("添加策略")
        add_button.clicked.connect(self.add_strategy)

        init_button = QtWidgets.QPushButton("全部初始化")
        init_button.clicked.connect(self.cta_engine.init_all_strategies)

        start_button = QtWidgets.QPushButton("全部启动")
        start_button.clicked.connect(self.cta_engine.start_all_strategies)

        stop_button = QtWidgets.QPushButton("全部停止")
        stop_button.clicked.connect(self.cta_engine.stop_all_strategies)

        clear_button = QtWidgets.QPushButton("清空日志")
        clear_button.clicked.connect(self.clear_log)

        self.scroll_layout = QtWidgets.QVBoxLayout()
        self.scroll_layout.addStretch()

        scroll_widget = QtWidgets.QWidget()
        scroll_widget.setLayout(self.scroll_layout)

        scroll_area = QtWidgets.QScrollArea()
        scroll_area.setWidgetResizable(True)
        scroll_area.setWidget(scroll_widget)

        self.log_monitor = LogMonitor(self.main_engine, self.event_engine)

        self.stop_order_monitor = StopOrderMonitor(
            self.main_engine, self.event_engine
        )

        self.limit_order_monitor = LimitOrderMonitor(
            self.main_engine,self.event_engine
        )

        # Set layout
        hbox1 = QtWidgets.QHBoxLayout()
        hbox1.addWidget(self.class_combo)
        hbox1.addWidget(add_button)
        hbox1.addStretch()
        hbox1.addWidget(init_button)
        hbox1.addWidget(start_button)
        hbox1.addWidget(stop_button)
        hbox1.addWidget(clear_button)

        grid = QtWidgets.QGridLayout()
        grid.addWidget(scroll_area, 0, 0, 2, 1)
        grid.addWidget(self.stop_order_monitor, 0, 1)
        grid.addWidget(self.limit_order_monitor,1,1)
        grid.addWidget(self.log_monitor, 2, 1)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(hbox1)
        vbox.addLayout(grid)

        self.setLayout(vbox)
コード例 #27
0
ファイル: widget.py プロジェクト: hjjwinner/VN_PY_PROJECT
    def init_ui(self):
        """"""
        self.setWindowTitle("CTA回测")

        # Setting Part
        self.class_combo = QtWidgets.QComboBox()
        self.class_combo.addItems(self.class_names)

        self.symbol_line = QtWidgets.QLineEdit("IF88.CFFEX")

        self.interval_combo = QtWidgets.QComboBox()
        for inteval in Interval:
            self.interval_combo.addItem(inteval.value)

        end_dt = datetime.now()
        start_dt = end_dt - timedelta(days=3 * 365)

        self.start_date_edit = QtWidgets.QDateEdit(
            QtCore.QDate(
                start_dt.year,
                start_dt.month,
                start_dt.day
            )
        )
        self.end_date_edit = QtWidgets.QDateEdit(
            QtCore.QDate.currentDate()
        )

        self.rate_line = QtWidgets.QLineEdit("0.000025")
        self.slippage_line = QtWidgets.QLineEdit("0.2")
        self.size_line = QtWidgets.QLineEdit("300")
        self.pricetick_line = QtWidgets.QLineEdit("0.2")
        self.capital_line = QtWidgets.QLineEdit("1000000")

        backtesting_button = QtWidgets.QPushButton("开始回测")
        backtesting_button.clicked.connect(self.start_backtesting)

        optimization_button = QtWidgets.QPushButton("参数优化")
        optimization_button.clicked.connect(self.start_optimization)

        self.result_button = QtWidgets.QPushButton("优化结果")
        self.result_button.clicked.connect(self.show_optimization_result)
        self.result_button.setEnabled(False)

        downloading_button = QtWidgets.QPushButton("下载数据")
        downloading_button.clicked.connect(self.start_downloading)

        self.order_button = QtWidgets.QPushButton("委托记录")
        self.order_button.clicked.connect(self.show_backtesting_orders)
        self.order_button.setEnabled(False)

        self.trade_button = QtWidgets.QPushButton("成交记录")
        self.trade_button.clicked.connect(self.show_backtesting_trades)
        self.trade_button.setEnabled(False)

        self.daily_button = QtWidgets.QPushButton("每日盈亏")
        self.daily_button.clicked.connect(self.show_daily_results)
        self.daily_button.setEnabled(False)

        self.candle_button = QtWidgets.QPushButton("K线图表")
        self.candle_button.clicked.connect(self.show_candle_chart)
        self.candle_button.setEnabled(False)

        for button in [
            backtesting_button,
            optimization_button,
            downloading_button,
            self.result_button,
            self.order_button,
            self.trade_button,
            self.daily_button,
            self.candle_button
        ]:
            button.setFixedHeight(button.sizeHint().height() * 2)

        form = QtWidgets.QFormLayout()
        form.addRow("交易策略", self.class_combo)
        form.addRow("本地代码", self.symbol_line)
        form.addRow("K线周期", self.interval_combo)
        form.addRow("开始日期", self.start_date_edit)
        form.addRow("结束日期", self.end_date_edit)
        form.addRow("手续费率", self.rate_line)
        form.addRow("交易滑点", self.slippage_line)
        form.addRow("合约乘数", self.size_line)
        form.addRow("价格跳动", self.pricetick_line)
        form.addRow("回测资金", self.capital_line)

        left_vbox = QtWidgets.QVBoxLayout()
        left_vbox.addLayout(form)
        left_vbox.addWidget(backtesting_button)
        left_vbox.addWidget(downloading_button)
        left_vbox.addStretch()
        left_vbox.addWidget(self.trade_button)
        left_vbox.addWidget(self.order_button)
        left_vbox.addWidget(self.daily_button)
        left_vbox.addWidget(self.candle_button)
        left_vbox.addStretch()
        left_vbox.addWidget(optimization_button)
        left_vbox.addWidget(self.result_button)

        # Result part
        self.statistics_monitor = StatisticsMonitor()

        self.log_monitor = QtWidgets.QTextEdit()
        self.log_monitor.setMaximumHeight(400)

        self.chart = BacktesterChart()
        self.chart.setMinimumWidth(1000)

        self.trade_dialog = BacktestingResultDialog(
            self.main_engine,
            self.event_engine,
            "回测成交记录",
            BacktestingTradeMonitor
        )
        self.order_dialog = BacktestingResultDialog(
            self.main_engine,
            self.event_engine,
            "回测委托记录",
            BacktestingOrderMonitor
        )
        self.daily_dialog = BacktestingResultDialog(
            self.main_engine,
            self.event_engine,
            "回测每日盈亏",
            DailyResultMonitor
        )

        # Candle Chart
        self.candle_dialog = CandleChartDialog()

        # Layout
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.statistics_monitor)
        vbox.addWidget(self.log_monitor)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addLayout(left_vbox)
        hbox.addLayout(vbox)
        hbox.addWidget(self.chart)
        self.setLayout(hbox)
コード例 #28
0
    def process_rule_event(self, event: Event) -> None:
        """"""
        rule_data = event.data

        name = rule_data["name"]
        formula = rule_data["formula"]
        params = rule_data["params"]
        ndigits = rule_data["ndigits"]

        if name not in self.cells:
            name_button = QtWidgets.QPushButton(name)
            name_func = partial(self.add_signal, name)
            name_button.clicked.connect(name_func)
            name_button.setToolTip("添加雷达信号")

            value_cell = RadarCell()
            time_cell = RadarCell()
            formula_cell = RadarCell(formula)
            a_cell = RadarCell(params.get("A", ""))
            b_cell = RadarCell(params.get("B", ""))
            c_cell = RadarCell(params.get("C", ""))
            d_cell = RadarCell(params.get("D", ""))
            e_cell = RadarCell(params.get("E", ""))
            ndigits_cell = RadarCell(str(ndigits))

            remove_func = partial(self.remove_rule, name)
            remove_button = QtWidgets.QPushButton("删除")
            remove_button.clicked.connect(remove_func)

            self.insertRow(0)
            self.setCellWidget(0, 0, name_button)
            self.setItem(0, 1, value_cell)
            self.setItem(0, 2, time_cell)
            self.setItem(0, 3, formula_cell)
            self.setItem(0, 4, a_cell)
            self.setItem(0, 5, b_cell)
            self.setItem(0, 6, c_cell)
            self.setItem(0, 7, d_cell)
            self.setItem(0, 8, e_cell)
            self.setItem(0, 9, ndigits_cell)
            self.setCellWidget(0, 10, remove_button)

            self.cells[name] = {
                "name": name_button,
                "value": value_cell,
                "time": time_cell,
                "formula": formula_cell,
                "a": a_cell,
                "b": b_cell,
                "c": c_cell,
                "d": d_cell,
                "e": e_cell,
                "ndigits": ndigits_cell
            }
        else:
            row_cells = self.cells[name]

            row_cells["formula"].setText(formula)
            row_cells["a"].setText(params.get("A", ""))
            row_cells["b"].setText(params.get("B", ""))
            row_cells["c"].setText(params.get("C", ""))
            row_cells["d"].setText(params.get("D", ""))
            row_cells["e"].setText(params.get("E", ""))
            row_cells["ndigits"].setText(str(ndigits))
コード例 #29
0
ファイル: widget.py プロジェクト: ajmal017/jonpy
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("期权交易")

        # Trading Area
        self.symbol_line = QtWidgets.QLineEdit()
        self.symbol_line.returnPressed.connect(self._update_symbol)

        float_validator = QtGui.QDoubleValidator()
        float_validator.setBottom(0)

        self.price_line = QtWidgets.QLineEdit()
        self.price_line.setValidator(float_validator)

        int_validator = QtGui.QIntValidator()
        int_validator.setBottom(0)

        self.volume_line = QtWidgets.QLineEdit()
        self.volume_line.setValidator(int_validator)

        self.direction_combo = QtWidgets.QComboBox()
        self.direction_combo.addItems(
            [Direction.LONG.value, Direction.SHORT.value])

        self.offset_combo = QtWidgets.QComboBox()
        self.offset_combo.addItems([Offset.OPEN.value, Offset.CLOSE.value])

        order_button = QtWidgets.QPushButton("委托")
        order_button.clicked.connect(self.send_order)

        cancel_button = QtWidgets.QPushButton("全撤")
        cancel_button.clicked.connect(self.cancel_all)

        form1 = QtWidgets.QFormLayout()
        form1.addRow("代码", self.symbol_line)
        form1.addRow("方向", self.direction_combo)
        form1.addRow("开平", self.offset_combo)
        form1.addRow("价格", self.price_line)
        form1.addRow("数量", self.volume_line)
        form1.addRow(order_button)
        form1.addRow(cancel_button)

        # Depth Area
        bid_color = "rgb(255,174,201)"
        ask_color = "rgb(160,255,160)"

        self.bp1_label = self.create_label(bid_color)
        self.bp2_label = self.create_label(bid_color)
        self.bp3_label = self.create_label(bid_color)
        self.bp4_label = self.create_label(bid_color)
        self.bp5_label = self.create_label(bid_color)

        self.bv1_label = self.create_label(bid_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.bv2_label = self.create_label(bid_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.bv3_label = self.create_label(bid_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.bv4_label = self.create_label(bid_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.bv5_label = self.create_label(bid_color,
                                           alignment=QtCore.Qt.AlignRight)

        self.ap1_label = self.create_label(ask_color)
        self.ap2_label = self.create_label(ask_color)
        self.ap3_label = self.create_label(ask_color)
        self.ap4_label = self.create_label(ask_color)
        self.ap5_label = self.create_label(ask_color)

        self.av1_label = self.create_label(ask_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.av2_label = self.create_label(ask_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.av3_label = self.create_label(ask_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.av4_label = self.create_label(ask_color,
                                           alignment=QtCore.Qt.AlignRight)
        self.av5_label = self.create_label(ask_color,
                                           alignment=QtCore.Qt.AlignRight)

        self.lp_label = self.create_label()
        self.return_label = self.create_label(alignment=QtCore.Qt.AlignRight)

        min_width = 70
        self.lp_label.setMinimumWidth(min_width)
        self.return_label.setMinimumWidth(min_width)

        form2 = QtWidgets.QFormLayout()
        form2.addRow(self.ap5_label, self.av5_label)
        form2.addRow(self.ap4_label, self.av4_label)
        form2.addRow(self.ap3_label, self.av3_label)
        form2.addRow(self.ap2_label, self.av2_label)
        form2.addRow(self.ap1_label, self.av1_label)
        form2.addRow(self.lp_label, self.return_label)
        form2.addRow(self.bp1_label, self.bv1_label)
        form2.addRow(self.bp2_label, self.bv2_label)
        form2.addRow(self.bp3_label, self.bv3_label)
        form2.addRow(self.bp4_label, self.bv4_label)
        form2.addRow(self.bp5_label, self.bv5_label)

        # Set layout
        hbox = QtWidgets.QHBoxLayout()
        hbox.addLayout(form1)
        hbox.addLayout(form2)
        self.setLayout(hbox)
コード例 #30
0
    def init_ui(self) -> None:
        """"""
        self.setWindowTitle("市场雷达")

        self.radar_monitor = RadarMonitor(self.radar_engine)
        self.signal_monitor = SignalMonitor(self.radar_engine)

        self.log_monitor = QtWidgets.QTextEdit()
        self.log_monitor.setReadOnly(True)

        self.name_line = QtWidgets.QLineEdit()
        self.formula_line = QtWidgets.QLineEdit()
        self.a_line = QtWidgets.QLineEdit()
        self.b_line = QtWidgets.QLineEdit()
        self.c_line = QtWidgets.QLineEdit()
        self.d_line = QtWidgets.QLineEdit()
        self.e_line = QtWidgets.QLineEdit()

        self.ndigits_spin = QtWidgets.QSpinBox()
        self.ndigits_spin.setMinimum(0)
        self.ndigits_spin.setValue(2)

        add_button = QtWidgets.QPushButton("添加")
        add_button.clicked.connect(self.add_rule)
        add_button.setFixedHeight(add_button.sizeHint().height() * 2)

        edit_button = QtWidgets.QPushButton("修改")
        edit_button.clicked.connect(self.edit_rule)
        edit_button.setFixedHeight(edit_button.sizeHint().height() * 2)

        load_button = QtWidgets.QPushButton("导入CSV")
        load_button.clicked.connect(self.load_csv)

        form = QtWidgets.QFormLayout()
        form.addRow("名称", self.name_line)
        form.addRow("公式", self.formula_line)
        form.addRow("A", self.a_line)
        form.addRow("B", self.b_line)
        form.addRow("C", self.c_line)
        form.addRow("D", self.d_line)
        form.addRow("E", self.e_line)
        form.addRow("小数", self.ndigits_spin)
        form.addRow(add_button)
        form.addRow(edit_button)

        vbox = QtWidgets.QVBoxLayout()
        vbox.addLayout(form)
        vbox.addStretch()
        vbox.addWidget(load_button)

        left_widget = QtWidgets.QWidget()
        left_widget.setLayout(vbox)
        left_widget.setFixedWidth(300)

        hbox = QtWidgets.QHBoxLayout()
        hbox.addWidget(left_widget)
        hbox.addWidget(self.signal_monitor)
        hbox.addWidget(self.log_monitor)

        vbox2 = QtWidgets.QVBoxLayout()
        vbox2.addWidget(self.radar_monitor)
        vbox2.addLayout(hbox)

        self.setLayout(vbox2)