diff --git a/hikyuu/gui/HikyuuTDX.py b/hikyuu/gui/HikyuuTDX.py index deef2ec31..fe5b03419 100644 --- a/hikyuu/gui/HikyuuTDX.py +++ b/hikyuu/gui/HikyuuTDX.py @@ -19,8 +19,9 @@ from hikyuu.gui.data.EscapetimeThread import EscapetimeThread from hikyuu.gui.data.UseTdxImportToH5Thread import UseTdxImportToH5Thread from hikyuu.gui.data.UsePytdxImportToH5Thread import UsePytdxImportToH5Thread -from hikyuu.gui.data.CollectThread import CollectThread -from hikyuu.gui.data.CollectToMemThread import CollectToMemThread +#from hikyuu.gui.data.CollectToMySQLThread import CollectToMySQLThread +#from hikyuu.gui.data.CollectToMemThread import CollectToMemThread +from hikyuu.gui.data.CollectSpotThread import CollectSpotThread from hikyuu.data import hku_config_template from hikyuu.util.mylog import add_class_logger_handler, class_logger, hku_logger @@ -49,12 +50,14 @@ def __init__(self, parent=None, capture_output=False, use_dark_style=False): self.initThreads() def closeEvent(self, event): - self.stop_collect() if self.import_running: QMessageBox.about(self, '提示', '正在执行导入任务,请耐心等候!') event.ignore() return + if self.collect_spot_thread is not None and self.collect_spot_thread.isRunning(): + self.collect_spot_thread.terminate() + self.saveConfig() if self.hdf5_import_thread: @@ -203,10 +206,14 @@ def initLogger(self): ) con.setFormatter(FORMAT) add_class_logger_handler( - con, [ - MyMainWindow, CollectThread, CollectToMemThread, UsePytdxImportToH5Thread, + con, + [ + MyMainWindow, + CollectSpotThread, #CollectToMySQLThread, CollectToMemThread, + UsePytdxImportToH5Thread, UseTdxImportToH5Thread - ], logging.INFO + ], + logging.INFO ) hku_logger.addHandler(con) @@ -234,8 +241,6 @@ def initUI(self): self.time_start_dateEdit.setDate(today - datetime.timedelta(7)) self.trans_start_dateEdit.setMinimumDate(today - datetime.timedelta(90)) self.time_start_dateEdit.setMinimumDate(today - datetime.timedelta(300)) - self.collect_running = False - self.collect_status_Label.setText("未启动") #读取保存的配置文件信息,如果不存在,则使用默认配置 this_dir = self.getUserConfigDir() @@ -332,12 +337,22 @@ def initUI(self): self.collect_use_zhima_checkBox.setChecked(use_zhima_proxy) self.collect_phase1_start_timeEdit.setTime( datetime.time.fromisoformat( - import_config.get('collect', 'phase1_start', fallback='09:05') + import_config.get('collect', 'phase1_start', fallback='09:00') ) ) self.collect_phase1_last_timeEdit.setTime( datetime.time.fromisoformat( - import_config.get('collect', 'phase1_end', fallback='15:15') + import_config.get('collect', 'phase1_end', fallback='12:05') + ) + ) + self.collect_phase2_start_timeEdit.setTime( + datetime.time.fromisoformat( + import_config.get('collect', 'phase2_start', fallback='13:00') + ) + ) + self.collect_phase2_last_timeEdit.setTime( + datetime.time.fromisoformat( + import_config.get('collect', 'phase2_end', fallback='15:05') ) ) @@ -455,7 +470,9 @@ def getCurrentConfig(self): 'interval': self.collect_sample_spinBox.value(), 'use_zhima_proxy': self.collect_use_zhima_checkBox.isChecked(), 'phase1_start': self.collect_phase1_start_timeEdit.time().toString(), - 'phase1_end': self.collect_phase1_last_timeEdit.time().toString() + 'phase1_end': self.collect_phase1_last_timeEdit.time().toString(), + 'phase2_start': self.collect_phase2_start_timeEdit.time().toString(), + 'phase2_end': self.collect_phase2_last_timeEdit.time().toString(), } import_config['preload'] = { 'day': self.preload_day_checkBox.isChecked(), @@ -487,8 +504,7 @@ def initThreads(self): self.escape_time_thread = None self.hdf5_import_thread = None self.mysql_import_thread = None - self.collect_sh_thread = None - self.collect_sz_thread = None + self.collect_spot_thread = None self.import_running = False self.hdf5_import_progress_bar = { @@ -705,55 +721,33 @@ def on_start_import_pushButton_clicked(self): self.escape_time_thread.message.connect(self.on_message_from_thread) self.escape_time_thread.start() - def start_collect(self): - self.collect_sh_thread = CollectThread( - self.getCurrentConfig(), self.getHikyuuConfigFileName(), 'SH' - ) - self.collect_sh_thread.start() - self.collect_sz_thread = CollectThread( - self.getCurrentConfig(), self.getHikyuuConfigFileName(), 'SZ' - ) - self.collect_sz_thread.start() - - def stop_collect(self): - self.logger.info("终止采集!") - if self.collect_sh_thread is not None: - self.collect_sh_thread.stop() - if self.collect_sz_thread is not None: - self.collect_sz_thread.stop() - @pyqtSlot() def on_collect_start_pushButton_clicked(self): - if self.collect_running: - self.collect_start_pushButton.setEnabled(False) - self.collect_status_Label.setText("正在停止...") - QApplication.processEvents() - self.stop_collect() - self.collect_start_pushButton.setText("启动定时采集") - self.collect_running = False - self.collect_status_Label.setText("已停止") - self.collect_start_pushButton.setEnabled(True) - else: - config = self.getCurrentConfig() - #if not config.getboolean("mysql", "enable", fallback=False): - # QMessageBox.critical(self, "定时采集", "仅在存储设置为 MySQL 时支持定时采集!") - # return - self.collect_status_Label.setText("正在启动...") - self.collect_start_pushButton.setEnabled(False) - QApplication.processEvents() - self.start_collect() - self.collect_start_pushButton.setText("停止采集") - self.collect_running = True - self.collect_status_Label.setText("运行中...") - self.collect_start_pushButton.setEnabled(True) + if self.collect_spot_thread is None or self.collect_spot_thread.isFinished(): + self.collect_spot_thread = CollectSpotThread( + self.getCurrentConfig(), + self.getHikyuuConfigFileName(), + ) + self.collect_spot_thread.start() + QMessageBox.about(self, '', '已启动,请在控制台日志查看是否正常运行') + + @pyqtSlot() + def on_collect_stop_pushButton_clicked(self): + if self.collect_spot_thread is not None and self.collect_spot_thread.isRunning(): + self.collect_spot_thread.terminate() + self.collect_spot_thread.wait() + QMessageBox.about(self, '', '已停止') class_logger(MyMainWindow) def start(): + logging.getLogger("requests").setLevel(logging.WARNING) + logging.getLogger("urllib3").setLevel(logging.WARNING) app = QApplication(sys.argv) - myWin = MyMainWindow(None) + use_dark_style = False # 使用暗黑主题 + myWin = MyMainWindow(capture_output=True, use_dark_style=use_dark_style) myWin.show() sys.exit(app.exec()) @@ -775,8 +769,8 @@ def start(): logging.StreamHandler(), ] ) - #myWin = MyMainWindow(capture_output=True, use_dark_style=use_dark_style) - myWin = MyMainWindow(capture_output=False, use_dark_style=use_dark_style) + myWin = MyMainWindow(capture_output=True, use_dark_style=use_dark_style) + #myWin = MyMainWindow(capture_output=False, use_dark_style=use_dark_style) else: myWin = MyMainWindow(capture_output=True, use_dark_style=use_dark_style) diff --git a/hikyuu/gui/data/CollectSpotThread.py b/hikyuu/gui/data/CollectSpotThread.py new file mode 100644 index 000000000..c411a2217 --- /dev/null +++ b/hikyuu/gui/data/CollectSpotThread.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# -*- coding: utf8 -*- +# cp936 + +import logging +import time +import datetime +from math import ceil +from PyQt5.QtCore import QThread, QWaitCondition, QMutex + +from hikyuu import Datetime, TimeDelta, hikyuu_init, StockManager, constant +from hikyuu.util import * +from hikyuu.fetcher.stock.zh_stock_a_sina_qq import get_spot, get_spot_parallel +from hikyuu.gui.spot_server import collect + + +class CollectSpotThread(QThread): + def __init__(self, config, hku_config_file): + super(self.__class__, self).__init__() + self.working = True + self._config = config + self.hku_config_file = hku_config_file + self._interval = config.getint('collect', 'interval', fallback=60 * 60) + self._phase1_start_time = config.get('collect', 'phase1_start', fallback='09:05') + self._phase1_end_time = config.get('collect', 'phase1_end', fallback='09:05') + self._phase2_start_time = config.get('collect', 'phase2_start', fallback='09:05') + self._phase2_end_time = config.get('collect', 'phase2_end', fallback='09:05') + self._use_zhima_proxy = config.getboolean('collect', 'use_zhima_proxy', fallback=False) + + def __del__(self): + hku_info("Quit CollectSpotThread") + + @hku_catch() + def run(self): + collect( + self._use_zhima_proxy, 'sina', self._interval, + '{}-{}'.format(self._phase1_start_time, self._phase1_end_time), + '{}-{}'.format(self._phase2_start_time, self._phase2_end_time), True + ) + + +class_logger(CollectSpotThread) \ No newline at end of file diff --git a/hikyuu/gui/data/CollectThread.py b/hikyuu/gui/data/CollectToMySQLThread.py similarity index 99% rename from hikyuu/gui/data/CollectThread.py rename to hikyuu/gui/data/CollectToMySQLThread.py index 9d1f25e83..fae2a9357 100644 --- a/hikyuu/gui/data/CollectThread.py +++ b/hikyuu/gui/data/CollectToMySQLThread.py @@ -16,7 +16,7 @@ from hikyuu.fetcher.stock.zh_stock_a_sina_qq import get_spot, get_spot_parallel -class CollectThread(QThread): +class CollectToMySQLThread(QThread): def __init__(self, config, market='SH'): super(self.__class__, self).__init__() self.working = True @@ -179,4 +179,4 @@ def get_stock_list(self): return ["{}{}".format(self.market.lower(), item[2]) for item in stk_list if item[3] == 1] -class_logger(CollectThread) \ No newline at end of file +class_logger(CollectToMySQLThread) \ No newline at end of file diff --git a/hikyuu/gui/data/MainWindow.py b/hikyuu/gui/data/MainWindow.py index 073f50924..1cbe2d57d 100644 --- a/hikyuu/gui/data/MainWindow.py +++ b/hikyuu/gui/data/MainWindow.py @@ -247,6 +247,70 @@ def setupUi(self, MainWindow): self.enable_mysql_radioButton.setGeometry(QtCore.QRect(170, 40, 89, 16)) self.enable_mysql_radioButton.setObjectName("enable_mysql_radioButton") self.tabWidget.addTab(self.tab_3, "") + self.tab_2 = QtWidgets.QWidget() + self.tab_2.setObjectName("tab_2") + self.start_import_pushButton = QtWidgets.QPushButton(self.tab_2) + self.start_import_pushButton.setGeometry(QtCore.QRect(30, 20, 75, 23)) + self.start_import_pushButton.setObjectName("start_import_pushButton") + self.groupBox_5 = QtWidgets.QGroupBox(self.tab_2) + self.groupBox_5.setGeometry(QtCore.QRect(20, 70, 551, 451)) + self.groupBox_5.setObjectName("groupBox_5") + self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_5) + self.layoutWidget_2.setGeometry(QtCore.QRect(10, 20, 531, 151)) + self.layoutWidget_2.setObjectName("layoutWidget_2") + self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget_2) + self.gridLayout.setContentsMargins(0, 0, 0, 0) + self.gridLayout.setObjectName("gridLayout") + self.label_8 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_8.setObjectName("label_8") + self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1) + self.label_4 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_4.setObjectName("label_4") + self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1) + self.label_14 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_14.setObjectName("label_14") + self.gridLayout.addWidget(self.label_14, 2, 0, 1, 1) + self.hdf5_trans_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) + self.hdf5_trans_progressBar.setProperty("value", 0) + self.hdf5_trans_progressBar.setObjectName("hdf5_trans_progressBar") + self.gridLayout.addWidget(self.hdf5_trans_progressBar, 3, 1, 1, 1) + self.hdf5_day_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) + self.hdf5_day_progressBar.setProperty("value", 0) + self.hdf5_day_progressBar.setObjectName("hdf5_day_progressBar") + self.gridLayout.addWidget(self.hdf5_day_progressBar, 0, 1, 1, 1) + self.label_5 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_5.setObjectName("label_5") + self.gridLayout.addWidget(self.label_5, 4, 0, 1, 1) + self.label_12 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_12.setObjectName("label_12") + self.gridLayout.addWidget(self.label_12, 1, 0, 1, 1) + self.hdf5_min_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) + self.hdf5_min_progressBar.setProperty("value", 0) + self.hdf5_min_progressBar.setObjectName("hdf5_min_progressBar") + self.gridLayout.addWidget(self.hdf5_min_progressBar, 2, 1, 1, 1) + self.hdf5_time_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) + self.hdf5_time_progressBar.setProperty("value", 0) + self.hdf5_time_progressBar.setObjectName("hdf5_time_progressBar") + self.gridLayout.addWidget(self.hdf5_time_progressBar, 4, 1, 1, 1) + self.hdf5_5min_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) + self.hdf5_5min_progressBar.setProperty("value", 0) + self.hdf5_5min_progressBar.setObjectName("hdf5_5min_progressBar") + self.gridLayout.addWidget(self.hdf5_5min_progressBar, 1, 1, 1, 1) + self.label_9 = QtWidgets.QLabel(self.layoutWidget_2) + self.label_9.setObjectName("label_9") + self.gridLayout.addWidget(self.label_9, 5, 0, 1, 1) + self.hdf5_weight_label = QtWidgets.QLabel(self.layoutWidget_2) + self.hdf5_weight_label.setObjectName("hdf5_weight_label") + self.gridLayout.addWidget(self.hdf5_weight_label, 5, 1, 1, 1) + self.import_detail_textEdit = QtWidgets.QTextEdit(self.groupBox_5) + self.import_detail_textEdit.setGeometry(QtCore.QRect(10, 180, 531, 261)) + self.import_detail_textEdit.setFrameShape(QtWidgets.QFrame.NoFrame) + self.import_detail_textEdit.setReadOnly(True) + self.import_detail_textEdit.setObjectName("import_detail_textEdit") + self.import_status_label = QtWidgets.QLabel(self.tab_2) + self.import_status_label.setGeometry(QtCore.QRect(140, 20, 361, 21)) + self.import_status_label.setObjectName("import_status_label") + self.tabWidget.addTab(self.tab_2, "") self.tab_6 = QtWidgets.QWidget() self.tab_6.setObjectName("tab_6") self.groupBox_6 = QtWidgets.QGroupBox(self.tab_6) @@ -255,251 +319,209 @@ def setupUi(self, MainWindow): self.save_pushButton = QtWidgets.QPushButton(self.groupBox_6) self.save_pushButton.setGeometry(QtCore.QRect(390, 190, 75, 23)) self.save_pushButton.setObjectName("save_pushButton") - self.widget = QtWidgets.QWidget(self.groupBox_6) - self.widget.setGeometry(QtCore.QRect(40, 80, 321, 282)) - self.widget.setObjectName("widget") - self.gridLayout_6 = QtWidgets.QGridLayout(self.widget) + self.layoutWidget3 = QtWidgets.QWidget(self.groupBox_6) + self.layoutWidget3.setGeometry(QtCore.QRect(40, 80, 321, 282)) + self.layoutWidget3.setObjectName("layoutWidget3") + self.gridLayout_6 = QtWidgets.QGridLayout(self.layoutWidget3) self.gridLayout_6.setContentsMargins(0, 0, 0, 0) self.gridLayout_6.setObjectName("gridLayout_6") - self.preload_day_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_day_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_day_checkBox.setObjectName("preload_day_checkBox") self.gridLayout_6.addWidget(self.preload_day_checkBox, 0, 0, 1, 1) - self.label_24 = QtWidgets.QLabel(self.widget) + self.label_24 = QtWidgets.QLabel(self.layoutWidget3) self.label_24.setObjectName("label_24") self.gridLayout_6.addWidget(self.label_24, 0, 1, 1, 1) - self.preload_day_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_day_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_day_spinBox.setMaximum(999999) self.preload_day_spinBox.setObjectName("preload_day_spinBox") self.gridLayout_6.addWidget(self.preload_day_spinBox, 0, 2, 1, 1) - self.preload_week_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_week_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_week_checkBox.setObjectName("preload_week_checkBox") self.gridLayout_6.addWidget(self.preload_week_checkBox, 1, 0, 1, 1) - self.label_25 = QtWidgets.QLabel(self.widget) + self.label_25 = QtWidgets.QLabel(self.layoutWidget3) self.label_25.setObjectName("label_25") self.gridLayout_6.addWidget(self.label_25, 1, 1, 1, 1) - self.preload_week_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_week_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_week_spinBox.setMaximum(999999) self.preload_week_spinBox.setObjectName("preload_week_spinBox") self.gridLayout_6.addWidget(self.preload_week_spinBox, 1, 2, 1, 1) - self.preload_month_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_month_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_month_checkBox.setObjectName("preload_month_checkBox") self.gridLayout_6.addWidget(self.preload_month_checkBox, 2, 0, 1, 1) - self.label_26 = QtWidgets.QLabel(self.widget) + self.label_26 = QtWidgets.QLabel(self.layoutWidget3) self.label_26.setObjectName("label_26") self.gridLayout_6.addWidget(self.label_26, 2, 1, 1, 1) - self.preload_month_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_month_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_month_spinBox.setMaximum(999999) self.preload_month_spinBox.setObjectName("preload_month_spinBox") self.gridLayout_6.addWidget(self.preload_month_spinBox, 2, 2, 1, 1) - self.preload_quarter_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_quarter_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_quarter_checkBox.setObjectName("preload_quarter_checkBox") self.gridLayout_6.addWidget(self.preload_quarter_checkBox, 3, 0, 1, 1) - self.label_27 = QtWidgets.QLabel(self.widget) + self.label_27 = QtWidgets.QLabel(self.layoutWidget3) self.label_27.setObjectName("label_27") self.gridLayout_6.addWidget(self.label_27, 3, 1, 1, 1) - self.preload_quarter_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_quarter_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_quarter_spinBox.setMaximum(999999) self.preload_quarter_spinBox.setObjectName("preload_quarter_spinBox") self.gridLayout_6.addWidget(self.preload_quarter_spinBox, 3, 2, 1, 1) - self.preload_halfyear_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_halfyear_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_halfyear_checkBox.setObjectName("preload_halfyear_checkBox") self.gridLayout_6.addWidget(self.preload_halfyear_checkBox, 4, 0, 1, 1) - self.label_28 = QtWidgets.QLabel(self.widget) + self.label_28 = QtWidgets.QLabel(self.layoutWidget3) self.label_28.setObjectName("label_28") self.gridLayout_6.addWidget(self.label_28, 4, 1, 1, 1) - self.preload_halfyear_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_halfyear_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_halfyear_spinBox.setMaximum(999999) self.preload_halfyear_spinBox.setObjectName("preload_halfyear_spinBox") self.gridLayout_6.addWidget(self.preload_halfyear_spinBox, 4, 2, 1, 1) - self.preload_year_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_year_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_year_checkBox.setObjectName("preload_year_checkBox") self.gridLayout_6.addWidget(self.preload_year_checkBox, 5, 0, 1, 1) - self.label_29 = QtWidgets.QLabel(self.widget) + self.label_29 = QtWidgets.QLabel(self.layoutWidget3) self.label_29.setObjectName("label_29") self.gridLayout_6.addWidget(self.label_29, 5, 1, 1, 1) - self.preload_year_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_year_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_year_spinBox.setMaximum(999999) self.preload_year_spinBox.setObjectName("preload_year_spinBox") self.gridLayout_6.addWidget(self.preload_year_spinBox, 5, 2, 1, 1) - self.preload_min1_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_min1_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_min1_checkBox.setObjectName("preload_min1_checkBox") self.gridLayout_6.addWidget(self.preload_min1_checkBox, 6, 0, 1, 1) - self.label_30 = QtWidgets.QLabel(self.widget) + self.label_30 = QtWidgets.QLabel(self.layoutWidget3) self.label_30.setObjectName("label_30") self.gridLayout_6.addWidget(self.label_30, 6, 1, 1, 1) - self.preload_min1_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_min1_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_min1_spinBox.setMaximum(999999) self.preload_min1_spinBox.setObjectName("preload_min1_spinBox") self.gridLayout_6.addWidget(self.preload_min1_spinBox, 6, 2, 1, 1) - self.preload_min5_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_min5_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_min5_checkBox.setObjectName("preload_min5_checkBox") self.gridLayout_6.addWidget(self.preload_min5_checkBox, 7, 0, 1, 1) - self.label_31 = QtWidgets.QLabel(self.widget) + self.label_31 = QtWidgets.QLabel(self.layoutWidget3) self.label_31.setObjectName("label_31") self.gridLayout_6.addWidget(self.label_31, 7, 1, 1, 1) - self.preload_min5_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_min5_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_min5_spinBox.setMaximum(999999) self.preload_min5_spinBox.setObjectName("preload_min5_spinBox") self.gridLayout_6.addWidget(self.preload_min5_spinBox, 7, 2, 1, 1) - self.preload_min15_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_min15_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_min15_checkBox.setObjectName("preload_min15_checkBox") self.gridLayout_6.addWidget(self.preload_min15_checkBox, 8, 0, 1, 1) - self.label_32 = QtWidgets.QLabel(self.widget) + self.label_32 = QtWidgets.QLabel(self.layoutWidget3) self.label_32.setObjectName("label_32") self.gridLayout_6.addWidget(self.label_32, 8, 1, 1, 1) - self.preload_min15_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_min15_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_min15_spinBox.setMaximum(999999) self.preload_min15_spinBox.setObjectName("preload_min15_spinBox") self.gridLayout_6.addWidget(self.preload_min15_spinBox, 8, 2, 1, 1) - self.preload_min30_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_min30_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_min30_checkBox.setObjectName("preload_min30_checkBox") self.gridLayout_6.addWidget(self.preload_min30_checkBox, 9, 0, 1, 1) - self.label_33 = QtWidgets.QLabel(self.widget) + self.label_33 = QtWidgets.QLabel(self.layoutWidget3) self.label_33.setObjectName("label_33") self.gridLayout_6.addWidget(self.label_33, 9, 1, 1, 1) - self.preload_min30_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_min30_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_min30_spinBox.setMaximum(999999) self.preload_min30_spinBox.setObjectName("preload_min30_spinBox") self.gridLayout_6.addWidget(self.preload_min30_spinBox, 9, 2, 1, 1) - self.preload_min60_checkBox = QtWidgets.QCheckBox(self.widget) + self.preload_min60_checkBox = QtWidgets.QCheckBox(self.layoutWidget3) self.preload_min60_checkBox.setObjectName("preload_min60_checkBox") self.gridLayout_6.addWidget(self.preload_min60_checkBox, 10, 0, 1, 1) - self.label_34 = QtWidgets.QLabel(self.widget) + self.label_34 = QtWidgets.QLabel(self.layoutWidget3) self.label_34.setObjectName("label_34") self.gridLayout_6.addWidget(self.label_34, 10, 1, 1, 1) - self.preload_min60_spinBox = QtWidgets.QSpinBox(self.widget) + self.preload_min60_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) self.preload_min60_spinBox.setMaximum(999999) self.preload_min60_spinBox.setObjectName("preload_min60_spinBox") self.gridLayout_6.addWidget(self.preload_min60_spinBox, 10, 2, 1, 1) - self.widget1 = QtWidgets.QWidget(self.groupBox_6) - self.widget1.setGeometry(QtCore.QRect(40, 30, 362, 32)) - self.widget1.setObjectName("widget1") - self.verticalLayout = QtWidgets.QVBoxLayout(self.widget1) + self.layoutWidget4 = QtWidgets.QWidget(self.groupBox_6) + self.layoutWidget4.setGeometry(QtCore.QRect(40, 30, 362, 32)) + self.layoutWidget4.setObjectName("layoutWidget4") + self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget4) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") - self.label_35 = QtWidgets.QLabel(self.widget1) + self.label_35 = QtWidgets.QLabel(self.layoutWidget4) self.label_35.setObjectName("label_35") self.verticalLayout.addWidget(self.label_35) - self.label_36 = QtWidgets.QLabel(self.widget1) + self.label_36 = QtWidgets.QLabel(self.layoutWidget4) self.label_36.setObjectName("label_36") self.verticalLayout.addWidget(self.label_36) self.tabWidget.addTab(self.tab_6, "") - self.tab_2 = QtWidgets.QWidget() - self.tab_2.setObjectName("tab_2") - self.start_import_pushButton = QtWidgets.QPushButton(self.tab_2) - self.start_import_pushButton.setGeometry(QtCore.QRect(30, 20, 75, 23)) - self.start_import_pushButton.setObjectName("start_import_pushButton") - self.groupBox_5 = QtWidgets.QGroupBox(self.tab_2) - self.groupBox_5.setGeometry(QtCore.QRect(20, 70, 551, 451)) - self.groupBox_5.setObjectName("groupBox_5") - self.layoutWidget_2 = QtWidgets.QWidget(self.groupBox_5) - self.layoutWidget_2.setGeometry(QtCore.QRect(10, 20, 531, 151)) - self.layoutWidget_2.setObjectName("layoutWidget_2") - self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget_2) - self.gridLayout.setContentsMargins(0, 0, 0, 0) - self.gridLayout.setObjectName("gridLayout") - self.label_8 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_8.setObjectName("label_8") - self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1) - self.label_4 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_4.setObjectName("label_4") - self.gridLayout.addWidget(self.label_4, 3, 0, 1, 1) - self.label_14 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_14.setObjectName("label_14") - self.gridLayout.addWidget(self.label_14, 2, 0, 1, 1) - self.hdf5_trans_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) - self.hdf5_trans_progressBar.setProperty("value", 0) - self.hdf5_trans_progressBar.setObjectName("hdf5_trans_progressBar") - self.gridLayout.addWidget(self.hdf5_trans_progressBar, 3, 1, 1, 1) - self.hdf5_day_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) - self.hdf5_day_progressBar.setProperty("value", 0) - self.hdf5_day_progressBar.setObjectName("hdf5_day_progressBar") - self.gridLayout.addWidget(self.hdf5_day_progressBar, 0, 1, 1, 1) - self.label_5 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_5.setObjectName("label_5") - self.gridLayout.addWidget(self.label_5, 4, 0, 1, 1) - self.label_12 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_12.setObjectName("label_12") - self.gridLayout.addWidget(self.label_12, 1, 0, 1, 1) - self.hdf5_min_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) - self.hdf5_min_progressBar.setProperty("value", 0) - self.hdf5_min_progressBar.setObjectName("hdf5_min_progressBar") - self.gridLayout.addWidget(self.hdf5_min_progressBar, 2, 1, 1, 1) - self.hdf5_time_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) - self.hdf5_time_progressBar.setProperty("value", 0) - self.hdf5_time_progressBar.setObjectName("hdf5_time_progressBar") - self.gridLayout.addWidget(self.hdf5_time_progressBar, 4, 1, 1, 1) - self.hdf5_5min_progressBar = QtWidgets.QProgressBar(self.layoutWidget_2) - self.hdf5_5min_progressBar.setProperty("value", 0) - self.hdf5_5min_progressBar.setObjectName("hdf5_5min_progressBar") - self.gridLayout.addWidget(self.hdf5_5min_progressBar, 1, 1, 1, 1) - self.label_9 = QtWidgets.QLabel(self.layoutWidget_2) - self.label_9.setObjectName("label_9") - self.gridLayout.addWidget(self.label_9, 5, 0, 1, 1) - self.hdf5_weight_label = QtWidgets.QLabel(self.layoutWidget_2) - self.hdf5_weight_label.setObjectName("hdf5_weight_label") - self.gridLayout.addWidget(self.hdf5_weight_label, 5, 1, 1, 1) - self.import_detail_textEdit = QtWidgets.QTextEdit(self.groupBox_5) - self.import_detail_textEdit.setGeometry(QtCore.QRect(10, 180, 531, 261)) - self.import_detail_textEdit.setFrameShape(QtWidgets.QFrame.NoFrame) - self.import_detail_textEdit.setReadOnly(True) - self.import_detail_textEdit.setObjectName("import_detail_textEdit") - self.import_status_label = QtWidgets.QLabel(self.tab_2) - self.import_status_label.setGeometry(QtCore.QRect(140, 20, 361, 21)) - self.import_status_label.setObjectName("import_status_label") - self.tabWidget.addTab(self.tab_2, "") self.tab = QtWidgets.QWidget() self.tab.setObjectName("tab") - self.layoutWidget3 = QtWidgets.QWidget(self.tab) - self.layoutWidget3.setGeometry(QtCore.QRect(40, 90, 158, 22)) - self.layoutWidget3.setObjectName("layoutWidget3") - self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.layoutWidget3) + self.layoutWidget5 = QtWidgets.QWidget(self.tab) + self.layoutWidget5.setGeometry(QtCore.QRect(40, 90, 158, 22)) + self.layoutWidget5.setObjectName("layoutWidget5") + self.horizontalLayout_10 = QtWidgets.QHBoxLayout(self.layoutWidget5) self.horizontalLayout_10.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_10.setObjectName("horizontalLayout_10") - self.label_23 = QtWidgets.QLabel(self.layoutWidget3) + self.label_23 = QtWidgets.QLabel(self.layoutWidget5) self.label_23.setObjectName("label_23") self.horizontalLayout_10.addWidget(self.label_23) - self.collect_sample_spinBox = QtWidgets.QSpinBox(self.layoutWidget3) + self.collect_sample_spinBox = QtWidgets.QSpinBox(self.layoutWidget5) self.collect_sample_spinBox.setMaximum(86400) self.collect_sample_spinBox.setObjectName("collect_sample_spinBox") self.horizontalLayout_10.addWidget(self.collect_sample_spinBox) - self.layoutWidget4 = QtWidgets.QWidget(self.tab) - self.layoutWidget4.setGeometry(QtCore.QRect(40, 30, 201, 25)) - self.layoutWidget4.setObjectName("layoutWidget4") - self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.layoutWidget4) + self.layoutWidget6 = QtWidgets.QWidget(self.tab) + self.layoutWidget6.setGeometry(QtCore.QRect(40, 30, 201, 25)) + self.layoutWidget6.setObjectName("layoutWidget6") + self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.layoutWidget6) self.horizontalLayout_11.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_11.setObjectName("horizontalLayout_11") - self.collect_start_pushButton = QtWidgets.QPushButton(self.layoutWidget4) + self.collect_start_pushButton = QtWidgets.QPushButton(self.layoutWidget6) self.collect_start_pushButton.setObjectName("collect_start_pushButton") self.horizontalLayout_11.addWidget(self.collect_start_pushButton) - self.collect_status_Label = QtWidgets.QLabel(self.layoutWidget4) - self.collect_status_Label.setObjectName("collect_status_Label") - self.horizontalLayout_11.addWidget(self.collect_status_Label) + self.collect_stop_pushButton = QtWidgets.QPushButton(self.layoutWidget6) + self.collect_stop_pushButton.setObjectName("collect_stop_pushButton") + self.horizontalLayout_11.addWidget(self.collect_stop_pushButton) self.collect_use_zhima_checkBox = QtWidgets.QCheckBox(self.tab) - self.collect_use_zhima_checkBox.setGeometry(QtCore.QRect(40, 190, 141, 16)) + self.collect_use_zhima_checkBox.setGeometry(QtCore.QRect(40, 230, 141, 16)) self.collect_use_zhima_checkBox.setObjectName("collect_use_zhima_checkBox") - self.layoutWidget5 = QtWidgets.QWidget(self.tab) - self.layoutWidget5.setGeometry(QtCore.QRect(40, 140, 214, 24)) - self.layoutWidget5.setObjectName("layoutWidget5") - self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.layoutWidget5) + self.layoutWidget7 = QtWidgets.QWidget(self.tab) + self.layoutWidget7.setGeometry(QtCore.QRect(40, 140, 214, 24)) + self.layoutWidget7.setObjectName("layoutWidget7") + self.horizontalLayout_8 = QtWidgets.QHBoxLayout(self.layoutWidget7) self.horizontalLayout_8.setContentsMargins(0, 0, 0, 0) self.horizontalLayout_8.setObjectName("horizontalLayout_8") - self.label_21 = QtWidgets.QLabel(self.layoutWidget5) + self.label_21 = QtWidgets.QLabel(self.layoutWidget7) self.label_21.setObjectName("label_21") self.horizontalLayout_8.addWidget(self.label_21) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") - self.collect_phase1_start_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget5) + self.collect_phase1_start_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget7) self.collect_phase1_start_timeEdit.setCurrentSection(QtWidgets.QDateTimeEdit.HourSection) self.collect_phase1_start_timeEdit.setObjectName("collect_phase1_start_timeEdit") self.horizontalLayout_6.addWidget(self.collect_phase1_start_timeEdit) - self.label_22 = QtWidgets.QLabel(self.layoutWidget5) + self.label_22 = QtWidgets.QLabel(self.layoutWidget7) self.label_22.setObjectName("label_22") self.horizontalLayout_6.addWidget(self.label_22) - self.collect_phase1_last_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget5) + self.collect_phase1_last_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget7) self.collect_phase1_last_timeEdit.setObjectName("collect_phase1_last_timeEdit") self.horizontalLayout_6.addWidget(self.collect_phase1_last_timeEdit) self.horizontalLayout_8.addLayout(self.horizontalLayout_6) + self.layoutWidget_9 = QtWidgets.QWidget(self.tab) + self.layoutWidget_9.setGeometry(QtCore.QRect(40, 180, 214, 24)) + self.layoutWidget_9.setObjectName("layoutWidget_9") + self.horizontalLayout_9 = QtWidgets.QHBoxLayout(self.layoutWidget_9) + self.horizontalLayout_9.setContentsMargins(0, 0, 0, 0) + self.horizontalLayout_9.setObjectName("horizontalLayout_9") + self.label_37 = QtWidgets.QLabel(self.layoutWidget_9) + self.label_37.setObjectName("label_37") + self.horizontalLayout_9.addWidget(self.label_37) + self.horizontalLayout_7 = QtWidgets.QHBoxLayout() + self.horizontalLayout_7.setObjectName("horizontalLayout_7") + self.collect_phase2_start_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget_9) + self.collect_phase2_start_timeEdit.setCurrentSection(QtWidgets.QDateTimeEdit.HourSection) + self.collect_phase2_start_timeEdit.setObjectName("collect_phase2_start_timeEdit") + self.horizontalLayout_7.addWidget(self.collect_phase2_start_timeEdit) + self.label_38 = QtWidgets.QLabel(self.layoutWidget_9) + self.label_38.setObjectName("label_38") + self.horizontalLayout_7.addWidget(self.label_38) + self.collect_phase2_last_timeEdit = QtWidgets.QTimeEdit(self.layoutWidget_9) + self.collect_phase2_last_timeEdit.setObjectName("collect_phase2_last_timeEdit") + self.horizontalLayout_7.addWidget(self.collect_phase2_last_timeEdit) + self.horizontalLayout_9.addLayout(self.horizontalLayout_7) self.tabWidget.addTab(self.tab, "") self.tab_5 = QtWidgets.QWidget() self.tab_5.setObjectName("tab_5") @@ -515,7 +537,7 @@ def setupUi(self, MainWindow): MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) - self.tabWidget.setCurrentIndex(3) + self.tabWidget.setCurrentIndex(2) QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): @@ -559,33 +581,6 @@ def retranslateUi(self, MainWindow): self.enable_hdf55_radioButton.setText(_translate("MainWindow", "使用HDF5(推荐)")) self.enable_mysql_radioButton.setText(_translate("MainWindow", "使用MYSQL")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "存储设置")) - self.groupBox_6.setTitle(_translate("MainWindow", "预加载设置")) - self.save_pushButton.setText(_translate("MainWindow", "保存设置")) - self.preload_day_checkBox.setText(_translate("MainWindow", "预加载日线")) - self.label_24.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_week_checkBox.setText(_translate("MainWindow", "预加载周线")) - self.label_25.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_month_checkBox.setText(_translate("MainWindow", "预加载月线")) - self.label_26.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_quarter_checkBox.setText(_translate("MainWindow", "预加载季线")) - self.label_27.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_halfyear_checkBox.setText(_translate("MainWindow", "预加载半年线")) - self.label_28.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_year_checkBox.setText(_translate("MainWindow", "预加载年线")) - self.label_29.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_min1_checkBox.setText(_translate("MainWindow", "预加载1分钟线")) - self.label_30.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_min5_checkBox.setText(_translate("MainWindow", "预加载5分钟线")) - self.label_31.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_min15_checkBox.setText(_translate("MainWindow", "预加载15分钟线")) - self.label_32.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_min30_checkBox.setText(_translate("MainWindow", "预加载30分钟线")) - self.label_33.setText(_translate("MainWindow", "最大缓存数量:")) - self.preload_min60_checkBox.setText(_translate("MainWindow", "预加载60分钟线")) - self.label_34.setText(_translate("MainWindow", "最大缓存数量:")) - self.label_35.setText(_translate("MainWindow", "此处为 Hikyuu 运行时的数据预加载设置,请根据机器内存大小选择")) - self.label_36.setText(_translate("MainWindow", "(目前加载全部日线数据目前需要约需900M内存)")) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("MainWindow", "其他设置")) self.start_import_pushButton.setText(_translate("MainWindow", "执行导入")) self.groupBox_5.setTitle(_translate("MainWindow", "导入进展")) self.label_8.setText(_translate("MainWindow", "导入日线:")) @@ -613,11 +608,40 @@ def retranslateUi(self, MainWindow): "

导入完毕!

")) self.import_status_label.setText(_translate("MainWindow", "import_status_label")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "执行导入")) + self.groupBox_6.setTitle(_translate("MainWindow", "预加载设置")) + self.save_pushButton.setText(_translate("MainWindow", "保存设置")) + self.preload_day_checkBox.setText(_translate("MainWindow", "预加载日线")) + self.label_24.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_week_checkBox.setText(_translate("MainWindow", "预加载周线")) + self.label_25.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_month_checkBox.setText(_translate("MainWindow", "预加载月线")) + self.label_26.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_quarter_checkBox.setText(_translate("MainWindow", "预加载季线")) + self.label_27.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_halfyear_checkBox.setText(_translate("MainWindow", "预加载半年线")) + self.label_28.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_year_checkBox.setText(_translate("MainWindow", "预加载年线")) + self.label_29.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_min1_checkBox.setText(_translate("MainWindow", "预加载1分钟线")) + self.label_30.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_min5_checkBox.setText(_translate("MainWindow", "预加载5分钟线")) + self.label_31.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_min15_checkBox.setText(_translate("MainWindow", "预加载15分钟线")) + self.label_32.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_min30_checkBox.setText(_translate("MainWindow", "预加载30分钟线")) + self.label_33.setText(_translate("MainWindow", "最大缓存数量:")) + self.preload_min60_checkBox.setText(_translate("MainWindow", "预加载60分钟线")) + self.label_34.setText(_translate("MainWindow", "最大缓存数量:")) + self.label_35.setText(_translate("MainWindow", "此处为 Hikyuu 运行时的数据预加载设置,请根据机器内存大小选择")) + self.label_36.setText(_translate("MainWindow", "(目前加载全部日线数据目前需要约需900M内存)")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("MainWindow", "预加载设置")) self.label_23.setText(_translate("MainWindow", "采集间隔(秒):")) - self.collect_start_pushButton.setText(_translate("MainWindow", "启动定时采集")) - self.collect_status_Label.setText(_translate("MainWindow", "TextLabel")) + self.collect_start_pushButton.setText(_translate("MainWindow", "启动采集")) + self.collect_stop_pushButton.setText(_translate("MainWindow", "停止采集")) self.collect_use_zhima_checkBox.setText(_translate("MainWindow", "使用芝麻代理")) - self.label_21.setText(_translate("MainWindow", "执行时间段:")) + self.label_21.setText(_translate("MainWindow", "执行时间段1:")) self.label_22.setText(_translate("MainWindow", "-")) - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "MySQL定时导入")) + self.label_37.setText(_translate("MainWindow", "执行时间段2:")) + self.label_38.setText(_translate("MainWindow", "-")) + self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "行情采集服务")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("MainWindow", "控制台日志")) diff --git a/hikyuu/gui/data/MainWindow.ui b/hikyuu/gui/data/MainWindow.ui index 9a02f8b83..1fcb16fa3 100644 --- a/hikyuu/gui/data/MainWindow.ui +++ b/hikyuu/gui/data/MainWindow.ui @@ -18,7 +18,7 @@ - 3 + 2 @@ -551,9 +551,183 @@ + + + 执行导入 + + + + + 30 + 20 + 75 + 23 + + + + 执行导入 + + + + + + 20 + 70 + 551 + 451 + + + + 导入进展 + + + + + 10 + 20 + 531 + 151 + + + + + + + 导入日线: + + + + + + + 导入分笔数据: + + + + + + + 导入1分钟线: + + + + + + + 0 + + + + + + + 0 + + + + + + + 导入分时数据: + + + + + + + 导入5分钟线: + + + + + + + 0 + + + + + + + 0 + + + + + + + 0 + + + + + + + 导入权息数据: + + + + + + + TextLabel + + + + + + + + + 10 + 180 + 531 + 261 + + + + QFrame::NoFrame + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证日线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证日线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证5分钟线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证5分钟线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证1分钟线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证1分钟线记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证分笔记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证分笔记录:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证分时数据:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证分时数据:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入权息数据数:</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入完毕!</p></body></html> + + + + + + + 140 + 20 + 361 + 21 + + + + import_status_label + + + - 其他设置 + 预加载设置 @@ -580,7 +754,7 @@ 保存设置 - + 40 @@ -823,7 +997,7 @@ - + 40 @@ -851,183 +1025,9 @@ - - - 执行导入 - - - - - 30 - 20 - 75 - 23 - - - - 执行导入 - - - - - - 20 - 70 - 551 - 451 - - - - 导入进展 - - - - - 10 - 20 - 531 - 151 - - - - - - - 导入日线: - - - - - - - 导入分笔数据: - - - - - - - 导入1分钟线: - - - - - - - 0 - - - - - - - 0 - - - - - - - 导入分时数据: - - - - - - - 导入5分钟线: - - - - - - - 0 - - - - - - - 0 - - - - - - - 0 - - - - - - - 导入权息数据: - - - - - - - TextLabel - - - - - - - - - 10 - 180 - 531 - 261 - - - - QFrame::NoFrame - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'SimSun'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证日线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证日线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证5分钟线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证5分钟线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证1分钟线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证1分钟线记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证分笔记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证分笔记录:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入上证分时数据:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入深证分时数据:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入权息数据数:</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">导入完毕!</p></body></html> - - - - - - - 140 - 20 - 361 - 21 - - - - import_status_label - - - - MySQL定时导入 + 行情采集服务 @@ -1068,14 +1068,14 @@ p, li { white-space: pre-wrap; } - 启动定时采集 + 启动采集 - + - TextLabel + 停止采集 @@ -1085,7 +1085,7 @@ p, li { white-space: pre-wrap; } 40 - 190 + 230 141 16 @@ -1107,7 +1107,7 @@ p, li { white-space: pre-wrap; } - 执行时间段: + 执行时间段1: @@ -1134,6 +1134,46 @@ p, li { white-space: pre-wrap; } + + + + 40 + 180 + 214 + 24 + + + + + + + 执行时间段2: + + + + + + + + + QDateTimeEdit::HourSection + + + + + + + - + + + + + + + + + + diff --git a/hikyuu/gui/collect.py b/hikyuu/gui/spot_server.py similarity index 98% rename from hikyuu/gui/collect.py rename to hikyuu/gui/spot_server.py index 84af4ef7e..a0abdd420 100644 --- a/hikyuu/gui/collect.py +++ b/hikyuu/gui/spot_server.py @@ -163,14 +163,7 @@ def next_delta(start_time, interval, phase1_delta, phase2_delta, ignore_weekend) return delta -@click.command() -@click.option('-use_proxy', '--use_proxy', is_flag=True, help='是否使用代理,须自行申请芝麻http代理并加入ip白名单') -@click.option('-source', '--source', default='sina', type=click.Choice(['sina', 'qq']), help='数据来源') -@click.option('-seconds', '--seconds', default=10) -@click.option('-phase1', '--phase1', default='9:00-9:00') -@click.option('-phase2', '--phase2', default='13:00-13:000') -@click.option('-ignore_weekend', '--ignore_weekend', is_flag=True) -def run(use_proxy, source, seconds, phase1, phase2, ignore_weekend): +def collect(use_proxy, source, seconds, phase1, phase2, ignore_weekend): phase1_delta = parse_phase(phase1) hku_error_if( phase1_delta is None or len(phase1_delta) != 2, @@ -260,6 +253,17 @@ def batch_func(records): time.sleep(10) +@click.command() +@click.option('-use_proxy', '--use_proxy', is_flag=True, help='是否使用代理,须自行申请芝麻http代理并加入ip白名单') +@click.option('-source', '--source', default='sina', type=click.Choice(['sina', 'qq']), help='数据来源') +@click.option('-seconds', '--seconds', default=10) +@click.option('-phase1', '--phase1', default='9:00-9:00') +@click.option('-phase2', '--phase2', default='13:00-13:000') +@click.option('-ignore_weekend', '--ignore_weekend', is_flag=True) +def run(use_proxy, source, seconds, phase1, phase2, ignore_weekend): + collect(use_proxy, source, seconds, phase1, phase2, ignore_weekend) + + if __name__ == '__main__': try: run() diff --git a/hikyuu_pywrap/agent/_SpotAgent.cpp b/hikyuu_pywrap/agent/_SpotAgent.cpp new file mode 100644 index 000000000..5e45ec362 --- /dev/null +++ b/hikyuu_pywrap/agent/_SpotAgent.cpp @@ -0,0 +1,17 @@ +/* + * Copyright(C) 2021 hikyuu.org + * + * Create on: 2021-01-30 + * Author: fasiondog + */ + +#include +#include + +using namespace boost::python; +using namespace hku; + +void export_SpotAgent() { + def("start_spot_agent", start_spot_agent); + def("stop_spot_agent", stop_spot_agent); +} diff --git a/hikyuu_pywrap/agent/agent_main.cpp b/hikyuu_pywrap/agent/agent_main.cpp new file mode 100644 index 000000000..3ceeaca7b --- /dev/null +++ b/hikyuu_pywrap/agent/agent_main.cpp @@ -0,0 +1,16 @@ +/* + * Copyright(C) 2021 hikyuu.org + * + * Create on: 2021-01-30 + * Author: fasiondog + */ + +#include + +using namespace boost::python; + +void export_SpotAgent(); + +void export_agent_main() { + export_SpotAgent(); +} diff --git a/hikyuu_pywrap/main.cpp b/hikyuu_pywrap/main.cpp index af57b2f58..18d30669f 100644 --- a/hikyuu_pywrap/main.cpp +++ b/hikyuu_pywrap/main.cpp @@ -38,6 +38,7 @@ void export_indicator_main(); void export_instance_main(); void export_trade_manage_main(); void export_trade_sys_main(); +void export_agent_main(); KData Py_GetKData(const string& market_code, py::object start = py::long_(0), py::object end = py::long_(Null()), KQuery::KType ktype = KQuery::DAY, @@ -119,6 +120,8 @@ BOOST_PYTHON_MODULE(core) { export_trade_sys_main(); export_trade_manage_main(); // must after export_trade_sys_main + export_agent_main(); + export_io_redirect(); py::def("hikyuu_init", hikyuu_init, (py::arg("filename"), py::arg("ignore_preload") = false)); diff --git a/hikyuu_pywrap/xmake.lua b/hikyuu_pywrap/xmake.lua index aecb32868..f613dbe71 100644 --- a/hikyuu_pywrap/xmake.lua +++ b/hikyuu_pywrap/xmake.lua @@ -32,7 +32,7 @@ target("core") set_default(false) --会默认禁用这个target的编译,除非显示指定xmake build _hikyuu才会去编译,但是target还存在,里面的files会保留到vcproj --set_enable(false) --set_enable(false)会彻底禁用这个target,连target的meta也不会被加载,vcproj不会保留它 end - add_packages("fmt", "spdlog") + add_packages("fmt", "spdlog", "flatbuffers") add_deps("hikyuu") if is_plat("windows") then set_filename("core.pyd")