data maintain tool(continue)

This commit is contained in:
fasiondog 2018-11-02 01:42:27 +08:00
parent 7a926d7657
commit e695df36f7
5 changed files with 203 additions and 96 deletions

View File

@ -23,10 +23,10 @@ class Ui_MainWindow(object):
self.start_import_pushButton.setGeometry(QtCore.QRect(540, 30, 75, 23))
self.start_import_pushButton.setObjectName("start_import_pushButton")
self.groupBox_2 = QtWidgets.QGroupBox(self.tab)
self.groupBox_2.setGeometry(QtCore.QRect(10, 90, 501, 91))
self.groupBox_2.setGeometry(QtCore.QRect(10, 90, 511, 91))
self.groupBox_2.setObjectName("groupBox_2")
self.layoutWidget = QtWidgets.QWidget(self.groupBox_2)
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 461, 61))
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 481, 61))
self.layoutWidget.setObjectName("layoutWidget")
self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget)
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
@ -56,10 +56,10 @@ class Ui_MainWindow(object):
self.select_tdx_dir_pushButton.setObjectName("select_tdx_dir_pushButton")
self.gridLayout_2.addWidget(self.select_tdx_dir_pushButton, 0, 3, 1, 1)
self.groupBox = QtWidgets.QGroupBox(self.tab)
self.groupBox.setGeometry(QtCore.QRect(10, 200, 501, 71))
self.groupBox.setGeometry(QtCore.QRect(10, 200, 511, 71))
self.groupBox.setObjectName("groupBox")
self.layoutWidget1 = QtWidgets.QWidget(self.groupBox)
self.layoutWidget1.setGeometry(QtCore.QRect(20, 30, 461, 22))
self.layoutWidget1.setGeometry(QtCore.QRect(20, 30, 481, 22))
self.layoutWidget1.setObjectName("layoutWidget1")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
@ -85,10 +85,10 @@ class Ui_MainWindow(object):
self.horizontalLayout.setStretch(1, 1)
self.horizontalLayout.setStretch(3, 1)
self.groupBox_3 = QtWidgets.QGroupBox(self.tab)
self.groupBox_3.setGeometry(QtCore.QRect(10, 290, 501, 101))
self.groupBox_3.setGeometry(QtCore.QRect(10, 290, 511, 101))
self.groupBox_3.setObjectName("groupBox_3")
self.layoutWidget2 = QtWidgets.QWidget(self.groupBox_3)
self.layoutWidget2.setGeometry(QtCore.QRect(20, 60, 461, 25))
self.layoutWidget2.setGeometry(QtCore.QRect(20, 60, 481, 25))
self.layoutWidget2.setObjectName("layoutWidget2")
self.gridLayout_3 = QtWidgets.QGridLayout(self.layoutWidget2)
self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
@ -106,7 +106,7 @@ class Ui_MainWindow(object):
self.hdf5_enable_checkBox.setGeometry(QtCore.QRect(20, 30, 121, 16))
self.hdf5_enable_checkBox.setObjectName("hdf5_enable_checkBox")
self.groupBox_4 = QtWidgets.QGroupBox(self.tab)
self.groupBox_4.setGeometry(QtCore.QRect(10, 410, 501, 151))
self.groupBox_4.setGeometry(QtCore.QRect(10, 410, 511, 151))
self.groupBox_4.setObjectName("groupBox_4")
self.mysql_enable_checkBox = QtWidgets.QCheckBox(self.groupBox_4)
self.mysql_enable_checkBox.setEnabled(False)
@ -117,22 +117,11 @@ class Ui_MainWindow(object):
self.pushButton_5.setGeometry(QtCore.QRect(20, 120, 101, 23))
self.pushButton_5.setObjectName("pushButton_5")
self.layoutWidget3 = QtWidgets.QWidget(self.groupBox_4)
self.layoutWidget3.setGeometry(QtCore.QRect(20, 60, 461, 48))
self.layoutWidget3.setGeometry(QtCore.QRect(20, 60, 481, 48))
self.layoutWidget3.setObjectName("layoutWidget3")
self.gridLayout_4 = QtWidgets.QGridLayout(self.layoutWidget3)
self.gridLayout_4.setContentsMargins(0, 0, 0, 0)
self.gridLayout_4.setObjectName("gridLayout_4")
self.mysql_pwd_lineEdit = QtWidgets.QLineEdit(self.layoutWidget3)
self.mysql_pwd_lineEdit.setEnabled(False)
self.mysql_pwd_lineEdit.setObjectName("mysql_pwd_lineEdit")
self.gridLayout_4.addWidget(self.mysql_pwd_lineEdit, 1, 4, 1, 1)
self.mysql_usr_lineEdit = QtWidgets.QLineEdit(self.layoutWidget3)
self.mysql_usr_lineEdit.setEnabled(False)
self.mysql_usr_lineEdit.setObjectName("mysql_usr_lineEdit")
self.gridLayout_4.addWidget(self.mysql_usr_lineEdit, 1, 1, 1, 1)
self.label_7 = QtWidgets.QLabel(self.layoutWidget3)
self.label_7.setObjectName("label_7")
self.gridLayout_4.addWidget(self.label_7, 1, 3, 1, 1)
self.mysql_host_lineEdit = QtWidgets.QLineEdit(self.layoutWidget3)
self.mysql_host_lineEdit.setEnabled(False)
self.mysql_host_lineEdit.setObjectName("mysql_host_lineEdit")
@ -144,49 +133,66 @@ class Ui_MainWindow(object):
self.label_4 = QtWidgets.QLabel(self.layoutWidget3)
self.label_4.setObjectName("label_4")
self.gridLayout_4.addWidget(self.label_4, 0, 0, 1, 1)
self.label_6 = QtWidgets.QLabel(self.layoutWidget3)
self.label_6.setObjectName("label_6")
self.gridLayout_4.addWidget(self.label_6, 1, 0, 1, 1)
self.label_5 = QtWidgets.QLabel(self.layoutWidget3)
self.label_5.setObjectName("label_5")
self.gridLayout_4.addWidget(self.label_5, 0, 3, 1, 1)
self.label_6 = QtWidgets.QLabel(self.layoutWidget3)
self.label_6.setObjectName("label_6")
self.gridLayout_4.addWidget(self.label_6, 1, 0, 1, 1)
self.label_7 = QtWidgets.QLabel(self.layoutWidget3)
self.label_7.setObjectName("label_7")
self.gridLayout_4.addWidget(self.label_7, 1, 3, 1, 1)
self.mysql_usr_lineEdit = QtWidgets.QLineEdit(self.layoutWidget3)
self.mysql_usr_lineEdit.setEnabled(False)
self.mysql_usr_lineEdit.setObjectName("mysql_usr_lineEdit")
self.gridLayout_4.addWidget(self.mysql_usr_lineEdit, 1, 1, 1, 1)
self.mysql_pwd_lineEdit = QtWidgets.QLineEdit(self.layoutWidget3)
self.mysql_pwd_lineEdit.setEnabled(False)
self.mysql_pwd_lineEdit.setObjectName("mysql_pwd_lineEdit")
self.gridLayout_4.addWidget(self.mysql_pwd_lineEdit, 1, 4, 1, 1)
spacerItem = QtWidgets.QSpacerItem(20, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_4.addItem(spacerItem, 0, 2, 1, 1)
self.groupBox_5 = QtWidgets.QGroupBox(self.tab)
self.groupBox_5.setGeometry(QtCore.QRect(530, 90, 521, 291))
self.groupBox_5.setObjectName("groupBox_5")
self.layoutWidget4 = QtWidgets.QWidget(self.groupBox_5)
self.layoutWidget4.setGeometry(QtCore.QRect(10, 20, 501, 81))
self.layoutWidget4.setGeometry(QtCore.QRect(10, 20, 501, 101))
self.layoutWidget4.setObjectName("layoutWidget4")
self.gridLayout = QtWidgets.QGridLayout(self.layoutWidget4)
self.gridLayout.setContentsMargins(0, 0, 0, 0)
self.gridLayout.setObjectName("gridLayout")
self.label_14 = QtWidgets.QLabel(self.layoutWidget4)
self.label_14.setObjectName("label_14")
self.gridLayout.addWidget(self.label_14, 2, 0, 1, 1)
self.label_8 = QtWidgets.QLabel(self.layoutWidget4)
self.label_8.setObjectName("label_8")
self.gridLayout.addWidget(self.label_8, 0, 0, 1, 1)
self.label_12 = QtWidgets.QLabel(self.layoutWidget4)
self.label_12.setObjectName("label_12")
self.gridLayout.addWidget(self.label_12, 1, 0, 1, 1)
self.hdf5_day_progressBar = QtWidgets.QProgressBar(self.layoutWidget4)
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.hdf5_min_progressBar = QtWidgets.QProgressBar(self.layoutWidget4)
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.label_14 = QtWidgets.QLabel(self.layoutWidget4)
self.label_14.setObjectName("label_14")
self.gridLayout.addWidget(self.label_14, 2, 0, 1, 1)
self.hdf5_5min_progressBar = QtWidgets.QProgressBar(self.layoutWidget4)
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.hdf5_day_progressBar = QtWidgets.QProgressBar(self.layoutWidget4)
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_9 = QtWidgets.QLabel(self.layoutWidget4)
self.label_9.setObjectName("label_9")
self.gridLayout.addWidget(self.label_9, 3, 0, 1, 1)
self.hdf5_weight_label = QtWidgets.QLabel(self.layoutWidget4)
self.hdf5_weight_label.setObjectName("hdf5_weight_label")
self.gridLayout.addWidget(self.hdf5_weight_label, 3, 1, 1, 1)
self.groupBox_6 = QtWidgets.QGroupBox(self.tab)
self.groupBox_6.setGeometry(QtCore.QRect(250, 20, 261, 51))
self.groupBox_6.setGeometry(QtCore.QRect(250, 20, 271, 51))
self.groupBox_6.setObjectName("groupBox_6")
self.layoutWidget5 = QtWidgets.QWidget(self.groupBox_6)
self.layoutWidget5.setGeometry(QtCore.QRect(20, 20, 238, 18))
self.layoutWidget5.setGeometry(QtCore.QRect(20, 20, 244, 18))
self.layoutWidget5.setObjectName("layoutWidget5")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget5)
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
@ -261,17 +267,19 @@ class Ui_MainWindow(object):
self.groupBox_4.setTitle(_translate("MainWindow", "MYSQL保存数据设置"))
self.mysql_enable_checkBox.setText(_translate("MainWindow", "保存至MYSQL数据库"))
self.pushButton_5.setText(_translate("MainWindow", "测试数据库连接"))
self.label_7.setText(_translate("MainWindow", "密码:"))
self.label_4.setText(_translate("MainWindow", "ip地址"))
self.label_6.setText(_translate("MainWindow", "用户名:"))
self.label_5.setText(_translate("MainWindow", "端口:"))
self.label_6.setText(_translate("MainWindow", "用户名:"))
self.label_7.setText(_translate("MainWindow", "密码:"))
self.groupBox_5.setTitle(_translate("MainWindow", "HDF5导入进展"))
self.label_14.setText(_translate("MainWindow", "导入1分钟线"))
self.label_8.setText(_translate("MainWindow", "导入日线:"))
self.label_12.setText(_translate("MainWindow", "导入5分钟线"))
self.label_14.setText(_translate("MainWindow", "导入1分钟线"))
self.label_9.setText(_translate("MainWindow", "导入权息数据:"))
self.hdf5_weight_label.setText(_translate("MainWindow", "TextLabel"))
self.groupBox_6.setTitle(_translate("MainWindow", "导入数据"))
self.import_day_checkBox.setText(_translate("MainWindow", "日线"))
self.import_min_checkBox.setText(_translate("MainWindow", "分钟线"))
self.import_min_checkBox.setText(_translate("MainWindow", "1分钟线"))
self.import_min5_checkBox.setText(_translate("MainWindow", "5分钟线"))
self.import_tick_checkBox.setText(_translate("MainWindow", "分笔"))
self.groupBox_7.setTitle(_translate("MainWindow", "导入行情"))

View File

@ -48,7 +48,7 @@
<rect>
<x>10</x>
<y>90</y>
<width>501</width>
<width>511</width>
<height>91</height>
</rect>
</property>
@ -60,7 +60,7 @@
<rect>
<x>20</x>
<y>20</y>
<width>461</width>
<width>481</width>
<height>61</height>
</rect>
</property>
@ -121,7 +121,7 @@
<rect>
<x>10</x>
<y>200</y>
<width>501</width>
<width>511</width>
<height>71</height>
</rect>
</property>
@ -133,7 +133,7 @@
<rect>
<x>20</x>
<y>30</y>
<width>461</width>
<width>481</width>
<height>22</height>
</rect>
</property>
@ -179,7 +179,7 @@
<rect>
<x>10</x>
<y>290</y>
<width>501</width>
<width>511</width>
<height>101</height>
</rect>
</property>
@ -191,7 +191,7 @@
<rect>
<x>20</x>
<y>60</y>
<width>461</width>
<width>481</width>
<height>25</height>
</rect>
</property>
@ -234,7 +234,7 @@
<rect>
<x>10</x>
<y>410</y>
<width>501</width>
<width>511</width>
<height>151</height>
</rect>
</property>
@ -278,32 +278,11 @@
<rect>
<x>20</x>
<y>60</y>
<width>461</width>
<width>481</width>
<height>48</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="4">
<widget class="QLineEdit" name="mysql_pwd_lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mysql_usr_lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_7">
<property name="text">
<string>密码:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mysql_host_lineEdit">
<property name="enabled">
@ -325,6 +304,13 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<property name="text">
<string>端口:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
@ -332,10 +318,24 @@
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="label_5">
<item row="1" column="3">
<widget class="QLabel" name="label_7">
<property name="text">
<string>端口:</string>
<string>密码:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mysql_usr_lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QLineEdit" name="mysql_pwd_lineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
@ -376,17 +376,10 @@
<x>10</x>
<y>20</y>
<width>501</width>
<height>81</height>
<height>101</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>导入1分钟线</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
@ -401,13 +394,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QProgressBar" name="hdf5_day_progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QProgressBar" name="hdf5_min_progressBar">
<property name="value">
@ -415,6 +401,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>导入1分钟线</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QProgressBar" name="hdf5_5min_progressBar">
<property name="value">
@ -422,6 +415,27 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QProgressBar" name="hdf5_day_progressBar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>导入权息数据:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="hdf5_weight_label">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@ -430,7 +444,7 @@
<rect>
<x>250</x>
<y>20</y>
<width>261</width>
<width>271</width>
<height>51</height>
</rect>
</property>
@ -442,7 +456,7 @@
<rect>
<x>20</x>
<y>20</y>
<width>238</width>
<width>244</width>
<height>18</height>
</rect>
</property>
@ -457,7 +471,7 @@
<item>
<widget class="QCheckBox" name="import_min_checkBox">
<property name="text">
<string>分钟线</string>
<string>1分钟线</string>
</property>
</widget>
</item>

View File

@ -2,6 +2,8 @@
# -*- coding: utf8 -*-
# cp936
import sqlite3
import subprocess
import urllib.request
from multiprocessing import Process, Queue
from hdf5import import *
@ -14,7 +16,7 @@ class ProgressBar:
self.src.queue.put([self.src.__class__.__name__, self.src.market, self.src.ktype, (cur+1) * 100 // total, 0])
class TdxImportTask:
def __init__(self, queue, sqlitefile, market, ktype, quotation, src_dir, dest_dir, progress=None):
def __init__(self, queue, sqlitefile, market, ktype, quotation, src_dir, dest_dir):
super(self.__class__, self).__init__()
self.queue = queue
self.sqlitefile = sqlitefile
@ -36,16 +38,45 @@ class TdxImportTask:
elif self.ktype == '5MIN':
self.src_dir = src_dir + "/vipdoc/sz/fzline"
self.dest_dir = dest_dir
self.progress = progress
def __del__(self):
print(self.__class__.__name__, self.market, self.ktype, "__del__")
def __call__(self):
count = 0
try:
connect = sqlite3.connect(self.sqlitefile)
progress = ProgressBar(self)
count = tdx_import_data(connect, self.market, self.ktype, self.quotation, self.src_dir, self.dest_dir, progress)
self.queue.put([self.__class__.__name__, self.market, self.ktype, None, count])
except Exception as e:
print(e)
self.queue.put([self.__class__.__name__, self.market, self.ktype, None, count])
class WeightImportTask:
def __init__(self, queue, sqlitefile, dest_dir):
self.queue = queue
self.sqlitefile = sqlitefile
self.dest_dir = dest_dir
def __call__(self):
total_count = 0
try:
self.queue.put([self.__class__.__name__, '...', 0, 0, 0])
connect = sqlite3.connect(self.sqlitefile)
net_file = urllib.request.urlopen('http://www.qianlong.com.cn/download/history/weight.rar', timeout=60)
dest_filename = self.dest_dir+'/weight.rar'
with open(dest_filename, 'wb') as file:
file.write(net_file.read())
self.queue.put([self.__class__.__name__, '...', 0, 0, 0])
os.system('unrar x -o+ -inul {} {}'.format(dest_filename, self.dest_dir))
self.queue.put([self.__class__.__name__, '...', 0, 0, 0])
total_count = qianlong_import_weight(connect, self.dest_dir + '/weight', 'SH')
total_count += qianlong_import_weight(connect, self.dest_dir + '/weight', 'SZ')
self.queue.put([self.__class__.__name__, '', 0, 0, total_count])
except Exception as e:
print(e)
self.queue.put([self.__class__.__name__, '', 0, None, total_count])

View File

@ -3,6 +3,7 @@
# cp936
import os.path
import pathlib
import struct
import sqlite3
import datetime
@ -557,11 +558,54 @@ def update_hdf5_extern_data(h5file, tablename, data_type):
pre_index_date = cur_index_date
index += 1
index_table.flush()
#h5file.close()
#print('\n')
if __name__ == '__main__':
def qianlong_import_weight(connect, src_dir, market):
"""导入钱龙格式的权息数据"""
cur = connect.cursor()
marketid = cur.execute("select marketid from Market where market='%s'" % market)
marketid = [id[0] for id in marketid]
marketid = marketid[0]
src_path = pathlib.Path(src_dir + '/shase/weight') if market == 'SH' else pathlib.Path(src_dir + '/sznse/weight')
wgt_file_list = list(src_path.glob('*.wgt'))
total_count = 0
for wgt_file in wgt_file_list:
code = wgt_file.stem
stockid = cur.execute("select stockid from Stock where marketid=%s and code='%s'" % (marketid, code))
stockid = [id[0] for id in stockid]
if not stockid:
continue
with wgt_file.open('rb') as sourcefile:
stockid = stockid[0]
a = cur.execute("select date from stkweight where stockid=%s" % stockid)
dateDict = dict([(i[0], None) for i in a])
records = []
data = sourcefile.read(36)
while data:
a = struct.unpack('iiiiiiiii', data)
date = (a[0] >> 20) * 10000 + (((a[0] << 12) & 4294967295) >> 28) * 100 + ((a[0] & 0xffff) >> 11)
if date not in dateDict:
records.append((stockid, date, a[1], a[2], a[3], a[4], a[5], a[6], a[7]))
data = sourcefile.read(36)
sourcefile.close()
if records:
cur.executemany("INSERT INTO StkWeight(stockid, date, countAsGift, \
countForSell, priceForSell, bonus, countOfIncreasement, totalCount, freeCount) \
VALUES (?,?,?,?,?,?,?,?,?)",
records)
total_count += len(records)
connect.commit()
cur.close()
return total_count
if __name__ == '__main__':
import time
starttime = time.time()
@ -584,9 +628,14 @@ if __name__ == '__main__':
print("\n导入数量:", add_count)
print("\n导入上证1分钟数据")
add_count = tdx_import_data(connect, 'SH', '1MIN', 'stock', src_dir + "\\vipdoc\\sh\\minline", dest_dir)
#add_count = tdx_import_data(connect, 'SH', '1MIN', 'stock', src_dir + "\\vipdoc\\sh\\minline", dest_dir)
print("\n导入数量:", add_count)
print("\n导入权息数据")
total_count = qianlong_import_weight(connect, r'C:\stock\weight', 'SH')
total_count += qianlong_import_weight(connect, r'C:\stock\weight', 'SZ')
print(total_count)
connect.close()
endtime = time.time()

View File

@ -14,7 +14,7 @@ from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QObject, QDate, QThreadPool
from PyQt5.QtGui import QTextCursor, QIcon, QBrush, QColor
from hdf5import import *
from TdxImportTask import TdxImportTask
from TdxImportTask import TdxImportTask, WeightImportTask
from MainWindow import *
@ -142,6 +142,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
self.tasks['HDF5_IMPORT_SZ_5MIN'] = TdxImportTask(self.queue, sqlite_file_name, 'SZ', '5MIN', 'stock', tdx_src_dir, dest_dir)
self.tasks['HDF5_IMPORT_SH_1MIN'] = TdxImportTask(self.queue, sqlite_file_name, 'SH', '1MIN','stock', tdx_src_dir, dest_dir)
self.tasks['HDF5_IMPORT_SZ_1MIN'] = TdxImportTask(self.queue, sqlite_file_name, 'SZ', '1MIN', 'stock', tdx_src_dir, dest_dir)
self.tasks['HDF5_IMPORT_WEIGHT'] = WeightImportTask(self.queue, sqlite_file_name, dest_dir)
#self.tdx_import_day_data_task = TdxImportTask(dest_dir + "\\hikyuu-stock.db", 'SH', 'stock', tdx_src_dir, dest_dir)
@pyqtSlot()
@ -175,6 +176,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
self.hdf5_dir_lineEdit.setText(dirname[0])
def reset_progress_bar(self):
self.hdf5_weight_label.setText('')
self.hdf5_day_progressBar.setValue(0)
self.hdf5_min_progressBar.setValue(0)
self.hdf5_5min_progressBar.setValue(0)
@ -202,6 +204,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
tdx_import_stock_name_from_file(connect, src_dir + "\\T0002\\hq_cache\\szm.tnf", 'SZ', 'stock')
tasks = []
tasks.append(self.tasks['HDF5_IMPORT_WEIGHT'])
if self.import_day_checkBox.isChecked():
tasks.append(self.tasks['HDF5_IMPORT_SH_DAY'])
tasks.append(self.tasks['HDF5_IMPORT_SZ_DAY'])
@ -226,7 +229,9 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
finished_count -= 1
continue
if taskname == 'TdxImportTask':
if taskname == 'WeightImportTask':
self.hdf5_weight_label.setText(market)
elif taskname == 'TdxImportTask':
hdf5_import_progress[market][ktype] = progress
current_progress = (hdf5_import_progress['SH'][ktype] + hdf5_import_progress['SZ'][ktype]) // 2
hdf5_import_progress_bar[ktype].setValue(current_progress)