From 4c0e461ab93144abbb1d5f4287b9071647e69270 Mon Sep 17 00:00:00 2001 From: Jet <344148042@qq.com> Date: Tue, 21 May 2024 19:32:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BE=BE=E4=BF=A1=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E6=97=B6=E5=80=99=E6=B2=A1=E6=9C=89=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=B4=A2=E5=8A=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hikyuu/gui/data/ImportHistoryFinanceTask.py | 5 +++++ hikyuu/gui/data/UseTdxImportToH5Thread.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hikyuu/gui/data/ImportHistoryFinanceTask.py b/hikyuu/gui/data/ImportHistoryFinanceTask.py index 2b54755d..b5d342d2 100644 --- a/hikyuu/gui/data/ImportHistoryFinanceTask.py +++ b/hikyuu/gui/data/ImportHistoryFinanceTask.py @@ -124,6 +124,11 @@ class ImportHistoryFinanceTask: if __name__ == "__main__": + from multiprocessing import Queue + from configparser import ConfigParser + this_dir = os.path.expanduser('~') + '/.hikyuu' + import_config = ConfigParser() + import_config.read(this_dir + '/importdata-gui.ini', encoding='utf-8') task = ImportHistoryFinanceTask(None, None, None, "c:\\stock") task() print("over!") diff --git a/hikyuu/gui/data/UseTdxImportToH5Thread.py b/hikyuu/gui/data/UseTdxImportToH5Thread.py index c42616eb..5c147e5f 100644 --- a/hikyuu/gui/data/UseTdxImportToH5Thread.py +++ b/hikyuu/gui/data/UseTdxImportToH5Thread.py @@ -28,6 +28,7 @@ from multiprocessing import Queue, Process from PyQt5.QtCore import QThread, pyqtSignal from hikyuu.gui.data.ImportTdxToH5Task import ImportTdxToH5Task from hikyuu.gui.data.ImportWeightToSqliteTask import ImportWeightToSqliteTask +from hikyuu.gui.data.ImportHistoryFinanceTask import ImportHistoryFinanceTask from hikyuu.data.common_sqlite3 import create_database from hikyuu.data.tdx_to_h5 import tdx_import_stock_name_from_file @@ -68,6 +69,8 @@ class UseTdxImportToH5Thread(QThread): self.tasks = [] if self.config.getboolean('weight', 'enable', fallback=False): self.tasks.append(ImportWeightToSqliteTask(self.log_queue, self.queue, self.config, dest_dir)) + if self.config.getboolean('finance', 'enable', fallback=True): + self.tasks.append(ImportHistoryFinanceTask(self.log_queue, self.queue, self.config, dest_dir)) if self.config.getboolean('ktype', 'day', fallback=False): self.tasks.append( ImportTdxToH5Task(self.log_queue, self.queue, config, 'SH', 'DAY', self.quotations, src_dir, dest_dir) @@ -149,5 +152,7 @@ class UseTdxImportToH5Thread(QThread): hdf5_import_progress[market][ktype] = progress current_progress = (hdf5_import_progress['SH'][ktype] + hdf5_import_progress['SZ'][ktype]) // 2 self.send_message(['IMPORT_KDATA', ktype, current_progress]) + elif taskname == 'IMPORT_KDATA': + self.send_message([taskname, progress]) else: self.logger.error("Unknow task: {}".format(taskname))