From bb3370b810801ad9387e59827f4609f55cd5ab28 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Tue, 24 Sep 2024 18:43:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=B4=A2=E5=8A=A1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8D=B3=E4=BD=BF=E6=B2=A1=E6=9C=89=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E4=B9=9F=E5=AF=BC=E5=85=A5=EF=BC=8C=E9=81=BF=E5=85=8D=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=BC=95=E6=93=8E=E5=90=8E=E4=B8=80=E6=96=B9=E6=9C=AA?= =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hikyuu/gui/data/ImportHistoryFinanceTask.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hikyuu/gui/data/ImportHistoryFinanceTask.py b/hikyuu/gui/data/ImportHistoryFinanceTask.py index b5d342d2..186aca4e 100644 --- a/hikyuu/gui/data/ImportHistoryFinanceTask.py +++ b/hikyuu/gui/data/ImportHistoryFinanceTask.py @@ -115,6 +115,13 @@ class ImportHistoryFinanceTask: old_md5 = hashlib.md5(f.read()).hexdigest() if old_md5 != item['hash']: self.download_file(item) + else: + # 不管是否有变化,都导入一次,以便切换引擎时可以导入 + shutil.unpack_archive(dest_file, extract_dir=self.dest_dir) + filename = item['filename'] + filename = f'{self.dest_dir}/{filename[0:-4]}.dat' + self.import_to_db(filename) + hku_info(f"Import finance file: {filename}") count += 1 self.queue.put([self.task_name, None, None, int(100 * count / self.total_count), self.total_count]) except Exception as e: