mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-01 11:28:32 +08:00
data maintain tool(continue)
This commit is contained in:
parent
d4e31d2336
commit
00adacffa3
@ -16,7 +16,7 @@ class EscapetimeThread(QThread):
|
||||
|
||||
def __del__(self):
|
||||
self.working = False
|
||||
print("EscapetimeThread", "__del__", self.escape_time/1000)
|
||||
#print("EscapetimeThread", "__del__", self.escape_time/1000)
|
||||
self.wait()
|
||||
|
||||
def send_message(self, msg):
|
||||
|
@ -20,11 +20,14 @@ class HDF5ImportThread(QThread):
|
||||
self.msg_task_name = ''
|
||||
|
||||
if not self.check():
|
||||
self.working = False
|
||||
return
|
||||
|
||||
self.process_list = []
|
||||
|
||||
src_dir = config['tdx']['dir']
|
||||
dest_dir = config['hdf5']['dir']
|
||||
sqlite_file_name = dest_dir + "/hikyuu-stock.db"
|
||||
sqlite_file_name = dest_dir + "/stock.db"
|
||||
|
||||
self.quotations = []
|
||||
if self.config['quotation']['stock']:
|
||||
@ -34,20 +37,24 @@ class HDF5ImportThread(QThread):
|
||||
|
||||
self.queue = Queue()
|
||||
self.tasks = []
|
||||
if self.config.getboolean('weight', 'enable', fallback=False):
|
||||
self.tasks.append(WeightImportTask(self.queue, sqlite_file_name, dest_dir))
|
||||
if self.config['ktype']['day']:
|
||||
if self.config.getboolean('ktype', 'day', fallback=False):
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SH', 'DAY', self.quotations, src_dir, dest_dir))
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SZ', 'DAY', self.quotations, src_dir, dest_dir))
|
||||
if self.config['ktype']['min5']:
|
||||
if self.config.getboolean('ktype', 'min5', fallback=False):
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SH', '5MIN', self.quotations, src_dir, dest_dir))
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SZ', '5MIN', self.quotations, src_dir, dest_dir))
|
||||
if self.config['ktype']['min']:
|
||||
if self.config.getboolean('ktype', 'min', fallback=False):
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SH', '1MIN', self.quotations, src_dir, dest_dir))
|
||||
self.tasks.append(TdxImportTask(self.queue, sqlite_file_name, 'SZ', '1MIN', self.quotations, src_dir, dest_dir))
|
||||
|
||||
|
||||
def __del__(self):
|
||||
print("HDF5ImportThread.__del__")
|
||||
#print("HDF5ImportThread.__del__")
|
||||
for p in self.process_list:
|
||||
if p.is_alive():
|
||||
p.terminate()
|
||||
|
||||
def check(self):
|
||||
return True
|
||||
@ -76,14 +83,16 @@ class HDF5ImportThread(QThread):
|
||||
#正在导入代码表
|
||||
self.send_message(['START_IMPORT_CODE'])
|
||||
|
||||
connect = sqlite3.connect(dest_dir + "\\hikyuu-stock.db")
|
||||
connect = sqlite3.connect(dest_dir + "\\stock.db")
|
||||
create_database(connect)
|
||||
|
||||
tdx_import_stock_name_from_file(connect, src_dir + "\\T0002\\hq_cache\\shm.tnf", 'SH', self.quotations)
|
||||
tdx_import_stock_name_from_file(connect, src_dir + "\\T0002\\hq_cache\\szm.tnf", 'SZ', self.quotations)
|
||||
|
||||
self.process_list.clear()
|
||||
for task in self.tasks:
|
||||
p = Process(target=task)
|
||||
self.process_list.append(p)
|
||||
p.start()
|
||||
|
||||
finished_count = len(self.tasks)
|
||||
@ -99,7 +108,7 @@ class HDF5ImportThread(QThread):
|
||||
continue
|
||||
|
||||
if taskname == 'WeightImportTask':
|
||||
self.send_message(['IMPORT_WEIGHT', market])
|
||||
self.send_message(['IMPORT_WEIGHT', market, total])
|
||||
elif taskname == 'TdxImportTask':
|
||||
hdf5_import_progress[market][ktype] = progress
|
||||
current_progress = (hdf5_import_progress['SH'][ktype] + hdf5_import_progress['SZ'][ktype]) // 2
|
||||
|
@ -23,69 +23,77 @@ 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, 511, 91))
|
||||
self.groupBox_2.setGeometry(QtCore.QRect(10, 130, 511, 121))
|
||||
self.groupBox_2.setObjectName("groupBox_2")
|
||||
self.layoutWidget = QtWidgets.QWidget(self.groupBox_2)
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 481, 61))
|
||||
self.layoutWidget.setGeometry(QtCore.QRect(20, 30, 300, 18))
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget)
|
||||
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.select_dzh_dir_pushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.select_dzh_dir_pushButton.setObjectName("select_dzh_dir_pushButton")
|
||||
self.gridLayout_2.addWidget(self.select_dzh_dir_pushButton, 1, 3, 1, 1)
|
||||
self.dzh_dir_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.dzh_dir_lineEdit.setObjectName("dzh_dir_lineEdit")
|
||||
self.gridLayout_2.addWidget(self.dzh_dir_lineEdit, 1, 2, 1, 1)
|
||||
self.tdx_enable_checkBox = QtWidgets.QCheckBox(self.layoutWidget)
|
||||
self.tdx_enable_checkBox.setObjectName("tdx_enable_checkBox")
|
||||
self.gridLayout_2.addWidget(self.tdx_enable_checkBox, 0, 0, 1, 1)
|
||||
self.label_2 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridLayout_2.addWidget(self.label_2, 0, 1, 1, 1)
|
||||
self.tdx_dir_lineEdit = QtWidgets.QLineEdit(self.layoutWidget)
|
||||
self.tdx_dir_lineEdit.setObjectName("tdx_dir_lineEdit")
|
||||
self.gridLayout_2.addWidget(self.tdx_dir_lineEdit, 0, 2, 1, 1)
|
||||
self.select_tdx_dir_pushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.select_tdx_dir_pushButton.setObjectName("select_tdx_dir_pushButton")
|
||||
self.gridLayout_2.addWidget(self.select_tdx_dir_pushButton, 0, 3, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(self.layoutWidget)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridLayout_2.addWidget(self.label_3, 1, 1, 1, 1)
|
||||
self.dzh_checkBox = QtWidgets.QCheckBox(self.layoutWidget)
|
||||
self.dzh_checkBox.setObjectName("dzh_checkBox")
|
||||
self.gridLayout_2.addWidget(self.dzh_checkBox, 1, 0, 1, 1)
|
||||
self.groupBox = QtWidgets.QGroupBox(self.tab)
|
||||
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, 481, 22))
|
||||
self.layoutWidget1.setObjectName("layoutWidget1")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget1)
|
||||
self.horizontalLayout.setSizeConstraint(QtWidgets.QLayout.SetDefaultConstraint)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
|
||||
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.tdx_radioButton = QtWidgets.QRadioButton(self.layoutWidget)
|
||||
self.tdx_radioButton.setObjectName("tdx_radioButton")
|
||||
self.horizontalLayout.addWidget(self.tdx_radioButton)
|
||||
self.pytdx_radioButton = QtWidgets.QRadioButton(self.layoutWidget)
|
||||
self.pytdx_radioButton.setEnabled(False)
|
||||
self.pytdx_radioButton.setObjectName("pytdx_radioButton")
|
||||
self.horizontalLayout.addWidget(self.pytdx_radioButton)
|
||||
self.layoutWidget1 = QtWidgets.QWidget(self.groupBox_2)
|
||||
self.layoutWidget1.setGeometry(QtCore.QRect(20, 60, 481, 51))
|
||||
self.layoutWidget1.setObjectName("layoutWidget1")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.layoutWidget1)
|
||||
self.gridLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.label_2 = QtWidgets.QLabel(self.layoutWidget1)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
|
||||
self.label_10 = QtWidgets.QLabel(self.layoutWidget1)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_10.sizePolicy().hasHeightForWidth())
|
||||
self.label_10.setSizePolicy(sizePolicy)
|
||||
self.label_10.setObjectName("label_10")
|
||||
self.horizontalLayout.addWidget(self.label_10)
|
||||
self.gridLayout_2.addWidget(self.label_10, 1, 0, 1, 2)
|
||||
self.tdx_servers_comboBox = QtWidgets.QComboBox(self.layoutWidget1)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.tdx_servers_comboBox.sizePolicy().hasHeightForWidth())
|
||||
self.tdx_servers_comboBox.setSizePolicy(sizePolicy)
|
||||
self.tdx_servers_comboBox.setObjectName("tdx_servers_comboBox")
|
||||
self.horizontalLayout.addWidget(self.tdx_servers_comboBox)
|
||||
self.label_11 = QtWidgets.QLabel(self.layoutWidget1)
|
||||
self.label_11.setObjectName("label_11")
|
||||
self.horizontalLayout.addWidget(self.label_11)
|
||||
self.gridLayout_2.addWidget(self.tdx_servers_comboBox, 1, 2, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(self.layoutWidget1)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
|
||||
self.label_3.setSizePolicy(sizePolicy)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridLayout_2.addWidget(self.label_3, 1, 3, 1, 1)
|
||||
self.tdx_port_lineEdit = QtWidgets.QLineEdit(self.layoutWidget1)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.tdx_port_lineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.tdx_port_lineEdit.setSizePolicy(sizePolicy)
|
||||
self.tdx_port_lineEdit.setMinimumSize(QtCore.QSize(10, 0))
|
||||
self.tdx_port_lineEdit.setMaxLength(6)
|
||||
self.tdx_port_lineEdit.setObjectName("tdx_port_lineEdit")
|
||||
self.horizontalLayout.addWidget(self.tdx_port_lineEdit)
|
||||
self.horizontalLayout.setStretch(1, 1)
|
||||
self.horizontalLayout.setStretch(3, 1)
|
||||
self.gridLayout_2.addWidget(self.tdx_port_lineEdit, 1, 4, 1, 1)
|
||||
self.select_tdx_dir_pushButton = QtWidgets.QPushButton(self.layoutWidget1)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.select_tdx_dir_pushButton.sizePolicy().hasHeightForWidth())
|
||||
self.select_tdx_dir_pushButton.setSizePolicy(sizePolicy)
|
||||
self.select_tdx_dir_pushButton.setObjectName("select_tdx_dir_pushButton")
|
||||
self.gridLayout_2.addWidget(self.select_tdx_dir_pushButton, 0, 4, 1, 1)
|
||||
self.tdx_dir_lineEdit = QtWidgets.QLineEdit(self.layoutWidget1)
|
||||
self.tdx_dir_lineEdit.setObjectName("tdx_dir_lineEdit")
|
||||
self.gridLayout_2.addWidget(self.tdx_dir_lineEdit, 0, 2, 1, 2)
|
||||
self.groupBox_3 = QtWidgets.QGroupBox(self.tab)
|
||||
self.groupBox_3.setGeometry(QtCore.QRect(10, 290, 511, 101))
|
||||
self.groupBox_3.setGeometry(QtCore.QRect(10, 270, 511, 101))
|
||||
self.groupBox_3.setObjectName("groupBox_3")
|
||||
self.layoutWidget2 = QtWidgets.QWidget(self.groupBox_3)
|
||||
self.layoutWidget2.setGeometry(QtCore.QRect(20, 60, 481, 25))
|
||||
@ -106,7 +114,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, 511, 151))
|
||||
self.groupBox_4.setGeometry(QtCore.QRect(10, 390, 511, 151))
|
||||
self.groupBox_4.setObjectName("groupBox_4")
|
||||
self.mysql_enable_checkBox = QtWidgets.QCheckBox(self.groupBox_4)
|
||||
self.mysql_enable_checkBox.setEnabled(False)
|
||||
@ -188,47 +196,60 @@ class Ui_MainWindow(object):
|
||||
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(210, 20, 271, 51))
|
||||
self.groupBox_6.setObjectName("groupBox_6")
|
||||
self.layoutWidget5 = QtWidgets.QWidget(self.groupBox_6)
|
||||
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)
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.import_day_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_day_checkBox.setObjectName("import_day_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_day_checkBox)
|
||||
self.import_min_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_min_checkBox.setObjectName("import_min_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_min_checkBox)
|
||||
self.import_min5_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_min5_checkBox.setObjectName("import_min5_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_min5_checkBox)
|
||||
self.import_tick_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_tick_checkBox.setEnabled(False)
|
||||
self.import_tick_checkBox.setObjectName("import_tick_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_tick_checkBox)
|
||||
self.import_detail_textEdit = QtWidgets.QTextEdit(self.groupBox_5)
|
||||
self.import_detail_textEdit.setGeometry(QtCore.QRect(10, 140, 501, 121))
|
||||
self.import_detail_textEdit.setFrameShape(QtWidgets.QFrame.NoFrame)
|
||||
self.import_detail_textEdit.setReadOnly(True)
|
||||
self.import_detail_textEdit.setObjectName("import_detail_textEdit")
|
||||
self.groupBox_7 = QtWidgets.QGroupBox(self.tab)
|
||||
self.groupBox_7.setGeometry(QtCore.QRect(10, 20, 181, 51))
|
||||
self.groupBox_7.setGeometry(QtCore.QRect(10, 20, 511, 91))
|
||||
self.groupBox_7.setObjectName("groupBox_7")
|
||||
self.layoutWidget6 = QtWidgets.QWidget(self.groupBox_7)
|
||||
self.layoutWidget6.setGeometry(QtCore.QRect(20, 20, 151, 18))
|
||||
self.layoutWidget6.setObjectName("layoutWidget6")
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.layoutWidget6)
|
||||
self.layoutWidget5 = QtWidgets.QWidget(self.groupBox_7)
|
||||
self.layoutWidget5.setGeometry(QtCore.QRect(20, 30, 191, 18))
|
||||
self.layoutWidget5.setObjectName("layoutWidget5")
|
||||
self.horizontalLayout_3 = QtWidgets.QHBoxLayout(self.layoutWidget5)
|
||||
self.horizontalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
|
||||
self.import_stock_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_stock_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_stock_checkBox.setObjectName("import_stock_checkBox")
|
||||
self.horizontalLayout_3.addWidget(self.import_stock_checkBox)
|
||||
self.import_fund_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_fund_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_fund_checkBox.setObjectName("import_fund_checkBox")
|
||||
self.horizontalLayout_3.addWidget(self.import_fund_checkBox)
|
||||
self.import_future_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_bond_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_bond_checkBox.setEnabled(False)
|
||||
self.import_bond_checkBox.setObjectName("import_bond_checkBox")
|
||||
self.horizontalLayout_3.addWidget(self.import_bond_checkBox)
|
||||
self.import_future_checkBox = QtWidgets.QCheckBox(self.layoutWidget5)
|
||||
self.import_future_checkBox.setEnabled(False)
|
||||
self.import_future_checkBox.setObjectName("import_future_checkBox")
|
||||
self.horizontalLayout_3.addWidget(self.import_future_checkBox)
|
||||
self.layoutWidget6 = QtWidgets.QWidget(self.groupBox_7)
|
||||
self.layoutWidget6.setGeometry(QtCore.QRect(20, 60, 291, 18))
|
||||
self.layoutWidget6.setObjectName("layoutWidget6")
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.layoutWidget6)
|
||||
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
self.import_day_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_day_checkBox.setObjectName("import_day_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_day_checkBox)
|
||||
self.import_min_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_min_checkBox.setObjectName("import_min_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_min_checkBox)
|
||||
self.import_min5_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_min5_checkBox.setObjectName("import_min5_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_min5_checkBox)
|
||||
self.import_tick_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_tick_checkBox.setEnabled(False)
|
||||
self.import_tick_checkBox.setObjectName("import_tick_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_tick_checkBox)
|
||||
self.import_min_time_checkBox = QtWidgets.QCheckBox(self.layoutWidget6)
|
||||
self.import_min_time_checkBox.setEnabled(False)
|
||||
self.import_min_time_checkBox.setObjectName("import_min_time_checkBox")
|
||||
self.horizontalLayout_2.addWidget(self.import_min_time_checkBox)
|
||||
self.import_weight_checkBox = QtWidgets.QCheckBox(self.groupBox_7)
|
||||
self.import_weight_checkBox.setGeometry(QtCore.QRect(250, 30, 151, 16))
|
||||
self.import_weight_checkBox.setObjectName("import_weight_checkBox")
|
||||
self.import_status_label = QtWidgets.QLabel(self.tab)
|
||||
self.import_status_label.setGeometry(QtCore.QRect(650, 30, 361, 21))
|
||||
self.import_status_label.setObjectName("import_status_label")
|
||||
@ -246,17 +267,14 @@ class Ui_MainWindow(object):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "数据导入工具"))
|
||||
self.start_import_pushButton.setText(_translate("MainWindow", "执行导入"))
|
||||
self.groupBox_2.setTitle(_translate("MainWindow", "K线数据源"))
|
||||
self.select_dzh_dir_pushButton.setText(_translate("MainWindow", "选择"))
|
||||
self.tdx_enable_checkBox.setText(_translate("MainWindow", "使用"))
|
||||
self.groupBox_2.setTitle(_translate("MainWindow", "数据源设置"))
|
||||
self.tdx_radioButton.setText(_translate("MainWindow", "使用通达信盘后数据(不支持分笔)"))
|
||||
self.pytdx_radioButton.setText(_translate("MainWindow", "使用Pytdx"))
|
||||
self.label_2.setText(_translate("MainWindow", "通达信安装目录:"))
|
||||
self.select_tdx_dir_pushButton.setText(_translate("MainWindow", "选择"))
|
||||
self.label_3.setText(_translate("MainWindow", "大智慧安装目录:"))
|
||||
self.dzh_checkBox.setText(_translate("MainWindow", "使用"))
|
||||
self.groupBox.setTitle(_translate("MainWindow", "Pytdx配置(权息、财务数据源)"))
|
||||
self.label_10.setText(_translate("MainWindow", "行情服务器:"))
|
||||
self.label_11.setText(_translate("MainWindow", "端口:"))
|
||||
self.label_10.setText(_translate("MainWindow", "通达信行情服务器:"))
|
||||
self.label_3.setText(_translate("MainWindow", "端口:"))
|
||||
self.tdx_port_lineEdit.setText(_translate("MainWindow", "7709"))
|
||||
self.select_tdx_dir_pushButton.setText(_translate("MainWindow", "选择"))
|
||||
self.groupBox_3.setTitle(_translate("MainWindow", "HDF5保存数据设置"))
|
||||
self.hdf5_dir_pushButton.setText(_translate("MainWindow", "选择"))
|
||||
self.label.setText(_translate("MainWindow", "目标数据(HDF5)存放目录:"))
|
||||
@ -274,15 +292,29 @@ class Ui_MainWindow(object):
|
||||
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_detail_textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'SimSun\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证日线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证日线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证5分钟线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证5分钟线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入上证1分钟线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入深证1分钟线记录:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入权息数据数:</p>\n"
|
||||
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">导入完毕!</p></body></html>"))
|
||||
self.groupBox_7.setTitle(_translate("MainWindow", "导入设置"))
|
||||
self.import_stock_checkBox.setText(_translate("MainWindow", "股票"))
|
||||
self.import_fund_checkBox.setText(_translate("MainWindow", "基金"))
|
||||
self.import_bond_checkBox.setText(_translate("MainWindow", "债券"))
|
||||
self.import_future_checkBox.setText(_translate("MainWindow", "期货"))
|
||||
self.import_day_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", "导入行情"))
|
||||
self.import_stock_checkBox.setText(_translate("MainWindow", "股票"))
|
||||
self.import_fund_checkBox.setText(_translate("MainWindow", "基金"))
|
||||
self.import_future_checkBox.setText(_translate("MainWindow", "期货"))
|
||||
self.import_min_time_checkBox.setText(_translate("MainWindow", "分时"))
|
||||
self.import_weight_checkBox.setText(_translate("MainWindow", "下载并导入钱龙权息数据"))
|
||||
self.import_status_label.setText(_translate("MainWindow", "import_status_label"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "数据导入"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Tab 2"))
|
||||
|
@ -47,130 +47,134 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<y>130</y>
|
||||
<width>511</width>
|
||||
<height>91</height>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>K线数据源</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>481</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="select_dzh_dir_pushButton">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="dzh_dir_lineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="tdx_enable_checkBox">
|
||||
<property name="text">
|
||||
<string>使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>通达信安装目录:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="tdx_dir_lineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QPushButton" name="select_tdx_dir_pushButton">
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>大智慧安装目录:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="dzh_checkBox">
|
||||
<property name="text">
|
||||
<string>使用</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<width>511</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Pytdx配置(权息、财务数据源)</string>
|
||||
<string>数据源设置</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>481</width>
|
||||
<height>22</height>
|
||||
<width>300</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="tdx_radioButton">
|
||||
<property name="text">
|
||||
<string>使用通达信盘后数据(不支持分笔)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="pytdx_radioButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>使用Pytdx</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>481</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>通达信安装目录:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>行情服务器:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="tdx_servers_comboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>端口:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="tdx_port_lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>7709</string>
|
||||
<string>通达信行情服务器:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="tdx_servers_comboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>端口:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLineEdit" name="tdx_port_lineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>7709</string>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<widget class="QPushButton" name="select_tdx_dir_pushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QLineEdit" name="tdx_dir_lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
@ -178,7 +182,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>290</y>
|
||||
<y>270</y>
|
||||
<width>511</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
@ -233,7 +237,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>410</y>
|
||||
<y>390</y>
|
||||
<width>511</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
@ -438,25 +442,101 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_6">
|
||||
<widget class="QTextEdit" name="import_detail_textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<x>10</x>
|
||||
<y>140</y>
|
||||
<width>501</width>
|
||||
<height>121</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!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></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>271</width>
|
||||
<height>51</height>
|
||||
<width>511</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>导入数据</string>
|
||||
<string>导入设置</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>244</width>
|
||||
<y>30</y>
|
||||
<width>191</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_stock_checkBox">
|
||||
<property name="text">
|
||||
<string>股票</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_fund_checkBox">
|
||||
<property name="text">
|
||||
<string>基金</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_bond_checkBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>债券</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_future_checkBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>期货</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>291</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -492,57 +572,31 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>181</width>
|
||||
<height>51</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>导入行情</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
<width>151</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_stock_checkBox">
|
||||
<property name="text">
|
||||
<string>股票</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_fund_checkBox">
|
||||
<property name="text">
|
||||
<string>基金</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="import_future_checkBox">
|
||||
<widget class="QCheckBox" name="import_min_time_checkBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>期货</string>
|
||||
<string>分时</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="import_weight_checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>30</y>
|
||||
<width>151</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>下载并导入钱龙权息数据</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="import_status_label">
|
||||
<property name="geometry">
|
||||
|
@ -40,7 +40,8 @@ class TdxImportTask:
|
||||
self.dest_dir = dest_dir
|
||||
|
||||
def __del__(self):
|
||||
print(self.__class__.__name__, self.market, self.ktype, "__del__")
|
||||
#print(self.__class__.__name__, self.market, self.ktype, "__del__")
|
||||
pass
|
||||
|
||||
def __call__(self):
|
||||
count = 0
|
||||
|
@ -615,7 +615,7 @@ if __name__ == '__main__':
|
||||
src_dir = "D:\\TdxW_HuaTai"
|
||||
dest_dir = "c:\\stock"
|
||||
|
||||
connect = sqlite3.connect(dest_dir + "\\hikyuu-stock.db")
|
||||
connect = sqlite3.connect(dest_dir + "\\stock.db")
|
||||
create_database(connect)
|
||||
|
||||
print("导入股票代码表")
|
||||
|
@ -28,9 +28,13 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.initThreads()
|
||||
|
||||
def closeEvent(self, event):
|
||||
if self.import_running:
|
||||
QMessageBox.about(self, '提示', '正在执行导入任务,请耐心等候!')
|
||||
event.ignore()
|
||||
return
|
||||
self.saveConfig()
|
||||
if self.hdf5_import_thread:
|
||||
self.hdf5_import_thread.terminate()
|
||||
self.hdf5_import_thread.stop()
|
||||
if self.escape_time_thread:
|
||||
self.escape_time_thread.stop()
|
||||
event.accept()
|
||||
@ -39,6 +43,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.setWindowIcon(QIcon("./hikyuu.ico"))
|
||||
self.setFixedSize(self.width(), self.height())
|
||||
self.import_status_label.setText('')
|
||||
self.import_detail_textEdit.clear()
|
||||
self.reset_progress_bar()
|
||||
|
||||
#读取保存的配置文件信息,如果不存在,则使用默认配置
|
||||
@ -58,28 +63,32 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.import_min5_checkBox.setChecked(import_config.getboolean('ktype', 'min5', fallback=True))
|
||||
self.import_tick_checkBox.setChecked(import_config.getboolean('ktype', 'tick', fallback=False))
|
||||
|
||||
#初始化权息数据设置
|
||||
self.import_weight_checkBox.setChecked(import_config.getboolean('weight', 'enable', fallback=True))
|
||||
|
||||
#初始化通道信目录配置
|
||||
tdx_enable = import_config.getboolean('tdx', 'enable', fallback=True)
|
||||
tdx_dir = import_config.get('tdx', 'dir', fallback='d:\TdxW_HuaTai')
|
||||
self.tdx_enable_checkBox.setChecked(tdx_enable)
|
||||
self.tdx_radioButton.setChecked(tdx_enable)
|
||||
self.tdx_dir_lineEdit.setEnabled(tdx_enable)
|
||||
self.select_tdx_dir_pushButton.setEnabled(tdx_enable)
|
||||
self.tdx_dir_lineEdit.setText(tdx_dir)
|
||||
|
||||
#初始化大智慧目录配置
|
||||
dzh_enable = import_config.getboolean('dzh', 'enable', fallback=False)
|
||||
dzh_dir = import_config.get('dzh', 'dir', fallback='')
|
||||
self.dzh_checkBox.setChecked(dzh_enable)
|
||||
self.dzh_dir_lineEdit.setText(dzh_dir)
|
||||
self.tdx_radioButton.toggled.connect(self.on_tdx_or_pytdx_toggled)
|
||||
|
||||
#初始化pytdx配置及显示
|
||||
tdx_server = import_config.get('pytdx', 'server', fallback='招商证券深圳行情')
|
||||
pytdx_enable = import_config.getboolean('pytdx', 'enable', fallback=False)
|
||||
pytdx_server = import_config.get('pytdx', 'server', fallback='招商证券深圳行情')
|
||||
self.pytdx_radioButton.setChecked(pytdx_enable)
|
||||
self.tdx_servers_comboBox.setDuplicatesEnabled(True)
|
||||
default_tdx_index = 0
|
||||
for i, host in enumerate(hq_hosts):
|
||||
self.tdx_servers_comboBox.addItem(host[0], host[1])
|
||||
if host[0] == tdx_server:
|
||||
if host[0] == pytdx_server:
|
||||
default_tdx_index = i
|
||||
self.tdx_servers_comboBox.setCurrentIndex(default_tdx_index)
|
||||
self.tdx_port_lineEdit.setText(str(hq_hosts[default_tdx_index][2]))
|
||||
self.tdx_servers_comboBox.setEnabled(pytdx_enable)
|
||||
self.tdx_port_lineEdit.setEnabled(pytdx_enable)
|
||||
|
||||
#初始化hdf5设置
|
||||
hdf5_enable = import_config.getboolean('hdf5', 'enable', fallback=True)
|
||||
@ -108,11 +117,11 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
'min': self.import_min_checkBox.isChecked(),
|
||||
'min5': self.import_min5_checkBox.isChecked(),
|
||||
'tick': self.import_tick_checkBox.isChecked()}
|
||||
import_config['tdx'] = {'enable': self.tdx_enable_checkBox.isChecked(),
|
||||
import_config['weight'] = {'enable': self.import_weight_checkBox.isChecked()}
|
||||
import_config['tdx'] = {'enable': self.tdx_radioButton.isChecked(),
|
||||
'dir': self.tdx_dir_lineEdit.text()}
|
||||
import_config['dzh'] = {'enable': self.dzh_checkBox.isChecked(),
|
||||
'dir': self.dzh_dir_lineEdit.text()}
|
||||
import_config['pytdx'] = {'server': self.tdx_servers_comboBox.currentText(),
|
||||
import_config['pytdx'] = {'enable': self.pytdx_radioButton.isChecked(),
|
||||
'server': self.tdx_servers_comboBox.currentText(),
|
||||
'ip': hq_hosts[self.tdx_servers_comboBox.currentIndex()][1],
|
||||
'port': hq_hosts[self.tdx_servers_comboBox.currentIndex()][2]}
|
||||
import_config['hdf5'] = {'enable': self.hdf5_enable_checkBox.isChecked(),
|
||||
@ -135,10 +144,18 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.hdf5_import_thread = None
|
||||
self.mysql_import_thread = None
|
||||
|
||||
self.import_running = False
|
||||
self.hdf5_import_progress_bar = {'DAY': self.hdf5_day_progressBar,
|
||||
'1MIN': self.hdf5_min_progressBar,
|
||||
'5MIN': self.hdf5_5min_progressBar}
|
||||
|
||||
def on_tdx_or_pytdx_toggled(self):
|
||||
tdx_enable = self.tdx_radioButton.isChecked()
|
||||
self.tdx_dir_lineEdit.setEnabled(tdx_enable)
|
||||
self.select_tdx_dir_pushButton.setEnabled(tdx_enable)
|
||||
self.tdx_servers_comboBox.setEnabled(not tdx_enable)
|
||||
self.tdx_port_lineEdit.setEnabled(not tdx_enable)
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def on_select_tdx_dir_pushButton_clicked(self):
|
||||
@ -175,9 +192,7 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.hdf5_day_progressBar.setValue(0)
|
||||
self.hdf5_min_progressBar.setValue(0)
|
||||
self.hdf5_5min_progressBar.setValue(0)
|
||||
|
||||
self.import_count = {'SH': {'DAY': 0, '1MIN': 0, '5MIN': 0},
|
||||
'SZ': {'DAY': 0, '1MIN': 0, '5MIN': 0}}
|
||||
self.import_detail_textEdit.clear()
|
||||
|
||||
def on_escapte_time(self, escape):
|
||||
self.import_status_label.setText("耗时:{:>.2f} 秒".format(escape))
|
||||
@ -196,28 +211,33 @@ class MyMainWindow(QMainWindow, Ui_MainWindow):
|
||||
if msg_task_name == 'THREAD':
|
||||
status = msg[2]
|
||||
if status == 'FAILURE':
|
||||
self.import_status_label.setText("耗时:{:>.2f} 秒 导入异常!{}".format(self.escape_time, msg[3]))
|
||||
self.import_status_label.setText("耗时:{:>.2f} 秒 导入异常!".format(self.escape_time))
|
||||
self.import_detail_textEdit.append(msg[3])
|
||||
self.hdf5_import_thread.terminate()
|
||||
self.hdf5_import_thread = None
|
||||
self.escape_time_thread.stop()
|
||||
self.escape_time_thread = None
|
||||
self.start_import_pushButton.setEnabled(True)
|
||||
self.import_detail_textEdit.append("导入完毕!")
|
||||
self.import_running = False
|
||||
|
||||
elif msg_task_name == 'IMPORT_KDATA':
|
||||
ktype, progress = msg[2:4]
|
||||
if ktype != 'FINISHED':
|
||||
self.hdf5_import_progress_bar[ktype].setValue(progress)
|
||||
else:
|
||||
print('导入记录数:', msg[3:])
|
||||
#self.import_count[msg[3]][msg[4]] = msg[5]
|
||||
self.import_detail_textEdit.append('导入 {} {} 记录数:{}'
|
||||
.format(msg[3], msg[4], msg[5]))
|
||||
|
||||
elif msg_task_name == 'IMPORT_WEIGHT':
|
||||
self.hdf5_weight_label.setText(msg[2])
|
||||
|
||||
if msg[2] == '导入完成!':
|
||||
self.import_detail_textEdit.append('导入权息记录数:{}'.format(msg[3]))
|
||||
|
||||
|
||||
@pyqtSlot()
|
||||
def on_start_import_pushButton_clicked(self):
|
||||
self.import_running = True
|
||||
self.start_import_pushButton.setEnabled(False)
|
||||
self.reset_progress_bar()
|
||||
|
||||
|
@ -38,6 +38,8 @@ if __name__ == '__main__':
|
||||
api = TdxHq_API()
|
||||
api.connect('119.147.212.81', 7709)
|
||||
|
||||
x = api.get_xdxr_info(TDXParams.MARKET_SH, '600030')
|
||||
print(x)
|
||||
x = api.get_history_transaction_data(TDXParams.MARKET_SZ, '000001', 4000, 2000, 20181102)
|
||||
for i in x:
|
||||
print(i)
|
||||
print(len(x))
|
||||
api.disconnect()
|
Loading…
Reference in New Issue
Block a user