diff --git a/hikyuu/gui/HikyuuTDX.py b/hikyuu/gui/HikyuuTDX.py index a6347efc..2ebd32ae 100644 --- a/hikyuu/gui/HikyuuTDX.py +++ b/hikyuu/gui/HikyuuTDX.py @@ -716,8 +716,6 @@ class MyMainWindow(QMainWindow, Ui_MainWindow): @pyqtSlot() def on_start_import_pushButton_clicked(self): - if not self._is_sched_import_running: - self.sched_import_pushButton.setEnabled(False) config = self.getCurrentConfig() dest_dir = config.get('hdf5', 'dir') if not os.path.exists(dest_dir) or not os.path.isdir(dest_dir): @@ -758,7 +756,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow): self.sched_import_pushButton.setText("启动定时导入") self.sched_import_thread.terminate() self.sched_import_thread.wait() - self.logger.info("已停止定时采集") + self.logger.info("已停止定时导入") self.sched_import_thread = None self.sched_import_pushButton.setEnabled(True) self.start_import_pushButton.setEnabled(True) diff --git a/hikyuu/gui/data/ImportWeightToSqliteTask.py b/hikyuu/gui/data/ImportWeightToSqliteTask.py index c533e15e..ef18042c 100644 --- a/hikyuu/gui/data/ImportWeightToSqliteTask.py +++ b/hikyuu/gui/data/ImportWeightToSqliteTask.py @@ -114,10 +114,12 @@ class ImportWeightToSqliteTask: api = TdxHq_API() api.connect(hosts[0][2], hosts[0][3]) + self.logger.info('正在导入权息数据') self.queue.put([self.msg_name, '正在导入权息数据...', 0, 0, 0]) total_count = pytdx_import_weight(api, connect, "SH") total_count += pytdx_import_weight(api, connect, "SZ") self.queue.put([self.msg_name, '导入权息数据完毕!', 0, 0, total_count]) + self.logger.info('导入权息数据完毕') #self.queue.put([self.msg_name, '下载通达信财务信息(上证)...', 0, 0, 0]) #x = pytdx_import_finance(connect, api, "SH") diff --git a/hikyuu/gui/data/MainWindow.py b/hikyuu/gui/data/MainWindow.py index c7d9f1a9..a2fa6112 100644 --- a/hikyuu/gui/data/MainWindow.py +++ b/hikyuu/gui/data/MainWindow.py @@ -675,9 +675,9 @@ class Ui_MainWindow(object): "\n" "

注:

\n" "


\n" -"

1、行情采集服务仅对预加载数据有效,在行情采集服务运行期间,hikyuu运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。

\n" +"

1、行情采集服务仅对预加载数据有效,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。

\n" "


\n" -"

2、如使用芝麻代理(http://h.zhimaruanjian.com/),请自行申请,并确保ip为其白名单

")) +"

2、如使用芝麻代理(http://h.zhimaruanjian.com/),请自行申请(需付费),并确保ip为其白名单。

")) self.label_39.setText(_translate("MainWindow", "行情数据源:")) self.collect_source_comboBox.setItemText(0, _translate("MainWindow", "sina")) self.collect_source_comboBox.setItemText(1, _translate("MainWindow", "qq")) diff --git a/hikyuu/gui/data/MainWindow.ui b/hikyuu/gui/data/MainWindow.ui index 276b8175..433a39e0 100644 --- a/hikyuu/gui/data/MainWindow.ui +++ b/hikyuu/gui/data/MainWindow.ui @@ -1199,9 +1199,9 @@ 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="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#ff0000;">1、行情采集服务仅对预加载数据有效</span>,在行情采集服务运行期间,hikyuu运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt; font-weight:600; color:#ff0000;">1、行情采集服务仅对预加载数据有效</span>,在行情采集服务运行期间,hikyuu.interactive运行时将自动连接采集服务获取行情数据,并更新预加载的内容数据。</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2、如使用芝麻代理(<a href="http://h.zhimaruanjian.com/"><span style=" text-decoration: underline; color:#0000ff;">http://h.zhimaruanjian.com/</span></a>),请自行申请,并确保ip为其白名单</p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2、如使用芝麻代理(<a href="http://h.zhimaruanjian.com/"><span style=" text-decoration: underline; color:#0000ff;">http://h.zhimaruanjian.com/</span></a>),请自行申请(需付费),并确保ip为其白名单。</p></body></html> diff --git a/hikyuu/gui/data/UsePytdxImportToH5Thread.py b/hikyuu/gui/data/UsePytdxImportToH5Thread.py index 013fbd11..75d5a393 100644 --- a/hikyuu/gui/data/UsePytdxImportToH5Thread.py +++ b/hikyuu/gui/data/UsePytdxImportToH5Thread.py @@ -42,6 +42,7 @@ from hikyuu.data.common_mysql import create_database as mysql_create_database from hikyuu.data.pytdx_to_mysql import import_stock_name as mysql_import_stock_name from hikyuu.util.mylog import class_logger + class UsePytdxImportToH5Thread(QThread): message = pyqtSignal(list) @@ -94,9 +95,11 @@ class UsePytdxImportToH5Thread(QThread): if self.config.getboolean('ktype', 'time', fallback=False): task_count += 2 + self.logger.info('搜索通达信服务器') self.send_message(['INFO', '搜索通达信服务器']) self.hosts = search_best_tdx() if not self.hosts: + self.logger.warn('无法连接通达信行情服务器!请检查网络设置!') self.send_message(['INFO', '无法连接通达信行情服务器!请检查网络设置!']) return @@ -227,8 +230,10 @@ class UsePytdxImportToH5Thread(QThread): self.init_task() self._run() except Exception as e: + self.logger.error(str(e)) self.send_message(['THREAD', 'FAILURE', str(e)]) else: + self.logger.info('导入完毕') self.send_message(['THREAD', 'FINISHED']) def _run(self): @@ -248,6 +253,7 @@ class UsePytdxImportToH5Thread(QThread): time_progress = {'SH': 0, 'SZ': 0} #正在导入代码表 + self.logger.info('导入股票代码表') self.send_message(['INFO', '导入股票代码表']) if self.config.getboolean('hdf5', 'enable', fallback=True): @@ -318,4 +324,5 @@ class UsePytdxImportToH5Thread(QThread): else: self.logger.error("Unknow task: {}".format(taskname)) + class_logger(UsePytdxImportToH5Thread) \ No newline at end of file diff --git a/hikyuu/gui/spot_server.py b/hikyuu/gui/spot_server.py index 7c39ffc0..81a9495e 100644 --- a/hikyuu/gui/spot_server.py +++ b/hikyuu/gui/spot_server.py @@ -225,14 +225,10 @@ def collect(use_proxy, source, seconds, phase1, phase2, ignore_weekend): phase1_time = [today + x for x in phase1_delta] phase2_time = [today + x for x in phase2_delta] start_time = Datetime.now() - if not ( - phase1_time[0] <= start_time <= phase1_time[1] - or phase2_time[0] <= start_time <= phase2_time[1] - ): - delta = next_delta(start_time, seconds, phase1_delta, phase2_delta, ignore_weekend) - next_time = start_time + delta - hku_info("启动采集时间:{}".format(next_time)) - time.sleep(delta.total_seconds()) + delta = next_delta(start_time, seconds, phase1_delta, phase2_delta, ignore_weekend) + next_time = start_time + delta + hku_info("启动采集时间:{}".format(next_time)) + time.sleep(delta.total_seconds()) while True: try: start_time = Datetime.now()