目录
前置:
代码
运行:
视频:
前置:
1 本系列将以 “PyQt6实例_A股日数据维护工具” 开头放置在“PyQt6实例”专栏
2 日数据可在“数据库”专栏,“PostgreSQL_”开头系列博文中获取
3 权息数据可以在“随想”专栏,“A股复权计算_”开头系列博文中获取
代码
import os.path
from PyQt6.QtCore import (
QSize,
QThread
)
from PyQt6.QtWidgets import (
QApplication,
QMainWindow,
QWidget,
QVBoxLayout,
QHBoxLayout,
QPushButton,
QLabel,
QLineEdit,
QGroupBox,
QTextEdit,
QTableWidget,
QTableWidgetItem,
QComboBox
)class MainWindow(QMainWindow):def __init__(self):super().__init__()self.setWindowTitle('股票日数据维护')self.setMinimumSize(QSize(800,600))self.btn_download = QPushButton('下载某个股票未复权数据',clicked=self.btn_download_clicked)self.btn_download_adj = QPushButton('下载某个股票前复权数据',clicked=self.btn_download_adj_clicked)self.btn_download_ex = QPushButton('下载某个股票的权息数据',clicked=self.btn_download_ex_clicked)groupbox1 = QGroupBox('日数据更新')groupbox2 = QGroupBox('权息数据更新')label11 = QLabel('增量日数据csv文件所在目录')label21 = QLabel('拆股数据csv文件位置:')label22 = QLabel('配股数据csv文件位置:')label23 = QLabel('分红数据csv文件位置:')self.lineedit_daily_dir = QLineEdit()self.lineedit_sqlits_file = QLineEdit()self.lineedit_allotment_file = QLineEdit()self.lineedit_equdiv_file = QLineEdit()self.btn_daily_dir = QPushButton('打开文件夹',clicked=self.btn_daily_dir_clicked)self.btn_splits_file = QPushButton('打开文件',clicked=self.btn_splits_file_clicked)self.btn_allotment_file = QPushButton('打开文件',clicked=self.btn_allotment_file_clicked)self.btn_equdiv_file = QPushButton('打开文件',clicked=self.btn_equdiv_file_clicked)self.btn_execute_daily = QPushButton('执行',clicked=self.btn_execute_daily_clicked)self.btn_execute_ex = QPushButton('执行',clicked=self.btn_execute_ex_clicked)self.btn_current_data = QPushButton('查看数据表中最新数据',clicked=self.btn_current_data_clicked)label31 = QLabel('运行日志:')label32 = QLabel('备忘信息:')self.btn_add_notes = QPushButton('添加',clicked=self.btn_add_notes_clicked)self.textedit_log = QTextEdit()self.table_widget = QTableWidget()self.table_widget.setColumnCount(3)self.table_widget.setHorizontalHeaderLabels(['时间','项','备忘内容'])layout00 = QHBoxLayout()layout00.addWidget(self.btn_download)layout00.addWidget(self.btn_download_adj)layout00.addWidget(self.btn_download_ex)layout11 = QHBoxLayout()layout11.addWidget(label11)layout11.addWidget(self.lineedit_daily_dir)layout11.addWidget(self.btn_daily_dir)layout12 = QHBoxLayout()layout12.addStretch(1)layout12.addWidget(self.btn_current_data)layout12.addWidget(self.btn_execute_daily)layout13 = QVBoxLayout()layout13.addLayout(layout11)layout13.addLayout(layout12)groupbox1.setLayout(layout13)layout21 = QHBoxLayout()layout21.addWidget(label21)layout21.addWidget(self.lineedit_sqlits_file)layout21.addWidget(self.btn_splits_file)layout22 = QHBoxLayout()layout22.addWidget(label22)layout22.addWidget(self.lineedit_allotment_file)layout22.addWidget(self.btn_allotment_file)layout23 = QHBoxLayout()layout23.addWidget(label23)layout23.addWidget(self.lineedit_equdiv_file)layout23.addWidget(self.btn_equdiv_file)layout24 = QHBoxLayout()layout24.addStretch(1)layout24.addWidget(self.btn_execute_ex)layout25 = QVBoxLayout()layout25.addLayout(layout21)layout25.addLayout(layout22)layout25.addLayout(layout23)layout25.addLayout(layout24)groupbox2.setLayout(layout25)layout31 = QVBoxLayout()layout31.addWidget(label31)layout31.addWidget(self.textedit_log)layout32 = QHBoxLayout()layout32.addWidget(label32)layout32.addWidget(self.btn_add_notes)layout33 = QVBoxLayout()layout33.addLayout(layout32)layout33.addWidget(self.table_widget)layout34 = QHBoxLayout()layout34.addLayout(layout31)layout34.addLayout(layout33)layout = QVBoxLayout()layout.addLayout(layout00)layout.addWidget(groupbox1)layout.addWidget(groupbox2)layout.addLayout(layout34)widget = QWidget()widget.setLayout(layout)self.setCentralWidget(widget)passdef btn_download_clicked(self):passdef btn_download_adj_clicked(self):passdef btn_download_ex_clicked(self):passdef btn_daily_dir_clicked(self):passdef btn_splits_file_clicked(self):passdef btn_allotment_file_clicked(self):passdef btn_equdiv_file_clicked(self):passdef btn_execute_daily_clicked(self):passdef btn_execute_ex_clicked(self):passdef btn_add_notes_clicked(self):passdef btn_current_data_clicked(self):passif __name__ == '__main__':app = QApplication([])mainwindow = MainWindow()mainwindow.show()app.exec()pass
运行:
视频:
https://www.bilibili.com/video/BV1TTZSYvEAz/
https://www.bilibili.com/video/BV13oZUYGE7d/
https://www.bilibili.com/video/BV1DFZSYuEuG/