<gh_stars>1-10
import sys
import efinance as ef
from PyQt5.QtWidgets import QDialog, QApplication, QInputDialog, QListWidgetItem
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(1440, 779)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(18, 13, 174, 18))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(198, 14, 347, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.Information = QtWidgets.QListWidget(Dialog)
        self.Information.setGeometry(QtCore.QRect(10, 80, 469, 321))
        self.Information.setObjectName("Information")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(603, 7, 179, 32))
        self.pushButton.setObjectName("pushButton")
        self.deleteOne = QtWidgets.QPushButton(Dialog)
        self.deleteOne.setGeometry(QtCore.QRect(778, 8, 181, 32))
        self.deleteOne.setObjectName("deleteOne")
        self.deleteAll = QtWidgets.QPushButton(Dialog)
        self.deleteAll.setGeometry(QtCore.QRect(959, 6, 209, 32))
        self.deleteAll.setObjectName("deleteAll")
        self.Realtime = QtWidgets.QListWidget(Dialog)
        self.Realtime.setGeometry(QtCore.QRect(1021, 203, 409, 94))
        self.Realtime.setObjectName("Realtime")
        self.history = QtWidgets.QListWidget(Dialog)
        self.history.setGeometry(QtCore.QRect(1023, 462, 408, 309))
        self.history.setObjectName("history")
        self.types = QtWidgets.QListWidget(Dialog)
        self.types.setGeometry(QtCore.QRect(1019, 79, 411, 96))
        self.types.setObjectName("types")
        self.industry = QtWidgets.QListWidget(Dialog)
        self.industry.setGeometry(QtCore.QRect(491, 430, 517, 342))
        self.industry.setObjectName("industry")
        self.public_2 = QtWidgets.QListWidget(Dialog)
        self.public_2.setGeometry(QtCore.QRect(1021, 325, 408, 104))
        self.public_2.setObjectName("public_2")
        self.inverst = QtWidgets.QListWidget(Dialog)
        self.inverst.setGeometry(QtCore.QRect(492, 80, 516, 320))
        self.inverst.setObjectName("inverst")
        self.period = QtWidgets.QListWidget(Dialog)
        self.period.setGeometry(QtCore.QRect(10, 430, 467, 342))
        self.period.setObjectName("period")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(191, 59, 81, 18))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(1162, 182, 111, 18))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(702, 59, 81, 18))
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(Dialog)
        self.label_5.setGeometry(QtCore.QRect(1162, 57, 111, 18))
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(Dialog)
        self.label_6.setGeometry(QtCore.QRect(206, 411, 61, 16))
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(Dialog)
        self.label_7.setGeometry(QtCore.QRect(1158, 304, 111, 18))
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(Dialog)
        self.label_8.setGeometry(QtCore.QRect(704, 410, 81, 18))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(Dialog)
        self.label_9.setGeometry(QtCore.QRect(1162, 440, 111, 20))
        self.label_9.setObjectName("label_9")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Fund Information Search Engine"))
        self.label.setText(_translate("Dialog", "                                 基金代码"))
        self.pushButton.setText(_translate("Dialog", "确认"))
        self.deleteOne.setText(_translate("Dialog", "删除一个"))
        self.deleteAll.setText(_translate("Dialog", "删除全部"))
        self.label_2.setText(_translate("Dialog", "基金基本信息"))
        self.label_3.setText(_translate("Dialog", "实时估算涨跌幅度"))
        self.label_4.setText(_translate("Dialog", "持仓占比信息"))
        self.label_5.setText(_translate("Dialog", "不同类型占比信息"))
        self.label_6.setText(_translate("Dialog", "阶段涨幅"))
        self.label_7.setText(_translate("Dialog", "历史更新持仓日期"))
        self.label_8.setText(_translate("Dialog", "行业分布信息"))
        self.label_9.setText(_translate("Dialog", "历史净值和涨跌幅"))


class MyForm(QDialog):
        def __init__(self):
            super().__init__()
            self.ui = Ui_Dialog()
            self.ui.setupUi(self)
        #   self.ui.listWidget.addItem(str(ef.fund.get_base_info('000689')))
            self.ui.pushButton.clicked.connect(self.addlist)
        #   self.ui.pushButtonEdit.clicked.connect(self.editlist)
            self.ui.deleteOne.clicked.connect(self.delitem)
            self.ui.deleteAll.clicked.connect(self.delallitems)
            self.show()

        def addlist(self):
            code = self.ui.lineEdit.text()
            self.ui.Information.addItem(str(ef.fund.get_base_info(code)))
            self.ui.Realtime.addItem(str(ef.fund.get_realtime_increase_rate(code)))
            self.ui.inverst.addItem(str(ef.fund.get_inverst_position(code)))
            self.ui.types.addItem(str(ef.fund.get_types_persentage(code)))
            self.ui.period.addItem(str(ef.fund.get_period_change(code)))
            self.ui.public_2.addItem(str(ef.fund.get_public_dates(code)))
            self.ui.industry.addItem(str(ef.fund.get_industry_distribution(code)))
            self.ui.history.addItem(str(ef.fund.get_quote_history(code)))
            self.ui.lineEdit.setText('')
            self.ui.lineEdit.setFocus()

#       def editlist(self):
#           row = self.ui.listWidget.currentRow()
#           newtext, ok = QInputDialog.getText(self, "Enter new text", "Enter new text")
#           if ok and (len(newtext) != 0):
#               self.ui.listWidget.takeItem(self.ui.listWidget.currentRow())
#               self.ui.listWidget.insertItem(row,QListWidgetItem(newtext))

        def delitem(self):
            self.ui.Information.takeItem(self.ui.Information.currentRow())
            self.ui.Realtime.takeItem(self.ui.Realtime.currentRow())
            self.ui.inverst.takeItem(self.ui.inverst.currentRow())
            self.ui.types.takeItem(self.ui.types.currentRow())
            self.ui.period.takeItem(self.ui.period.currentRow())
            self.ui.public_2.takeItem(self.ui.public_2.currentRow())
            self.ui.industry.takeItem(self.ui.industry.currentRow())
            self.ui.history.takeItem(self.ui.history.currentRow())

        def delallitems(self):
            self.ui.Information.clear()
            self.ui.Realtime.clear()
            self.ui.inverst.clear()
            self.ui.types.clear()
            self.ui.period.clear()
            self.ui.public_2.clear()
            self.ui.industry.clear()
            self.ui.history.clear()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = MyForm()
    w.show()
    sys.exit(app.exec_())
import sys
import efinance as ef
from PyQt5.QtWidgets import QDialog, QApplication, QInputDialog, QListWidgetItem
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(1440, 779)
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(18, 13, 174, 18))
        self.label.setObjectName("label")
        self.lineEdit = QtWidgets.QLineEdit(Dialog)
        self.lineEdit.setGeometry(QtCore.QRect(198, 14, 347, 21))
        self.lineEdit.setObjectName("lineEdit")
        self.Information = QtWidgets.QListWidget(Dialog)
        self.Information.setGeometry(QtCore.QRect(10, 80, 469, 321))
        self.Information.setObjectName("Information")
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(603, 7, 179, 32))
        self.pushButton.setObjectName("pushButton")
        self.deleteOne = QtWidgets.QPushButton(Dialog)
        self.deleteOne.setGeometry(QtCore.QRect(778, 8, 181, 32))
        self.deleteOne.setObjectName("deleteOne")
        self.deleteAll = QtWidgets.QPushButton(Dialog)
        self.deleteAll.setGeometry(QtCore.QRect(959, 6, 209, 32))
        self.deleteAll.setObjectName("deleteAll")
        self.Realtime = QtWidgets.QListWidget(Dialog)
        self.Realtime.setGeometry(QtCore.QRect(1021, 203, 409, 94))
        self.Realtime.setObjectName("Realtime")
        self.history = QtWidgets.QListWidget(Dialog)
        self.history.setGeometry(QtCore.QRect(1023, 462, 408, 309))
        self.history.setObjectName("history")
        self.types = QtWidgets.QListWidget(Dialog)
        self.types.setGeometry(QtCore.QRect(1019, 79, 411, 96))
        self.types.setObjectName("types")
        self.industry = QtWidgets.QListWidget(Dialog)
        self.industry.setGeometry(QtCore.QRect(491, 430, 517, 342))
        self.industry.setObjectName("industry")
        self.public_2 = QtWidgets.QListWidget(Dialog)
        self.public_2.setGeometry(QtCore.QRect(1021, 325, 408, 104))
        self.public_2.setObjectName("public_2")
        self.inverst = QtWidgets.QListWidget(Dialog)
        self.inverst.setGeometry(QtCore.QRect(492, 80, 516, 320))
        self.inverst.setObjectName("inverst")
        self.period = QtWidgets.QListWidget(Dialog)
        self.period.setGeometry(QtCore.QRect(10, 430, 467, 342))
        self.period.setObjectName("period")
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(191, 59, 81, 18))
        self.label_2.setObjectName("label_2")
        self.label_3 = QtWidgets.QLabel(Dialog)
        self.label_3.setGeometry(QtCore.QRect(1162, 182, 111, 18))
        self.label_3.setObjectName("label_3")
        self.label_4 = QtWidgets.QLabel(Dialog)
        self.label_4.setGeometry(QtCore.QRect(702, 59, 81, 18))
        self.label_4.setObjectName("label_4")
        self.label_5 = QtWidgets.QLabel(Dialog)
        self.label_5.setGeometry(QtCore.QRect(1162, 57, 111, 18))
        self.label_5.setObjectName("label_5")
        self.label_6 = QtWidgets.QLabel(Dialog)
        self.label_6.setGeometry(QtCore.QRect(206, 411, 61, 16))
        self.label_6.setObjectName("label_6")
        self.label_7 = QtWidgets.QLabel(Dialog)
        self.label_7.setGeometry(QtCore.QRect(1158, 304, 111, 18))
        self.label_7.setObjectName("label_7")
        self.label_8 = QtWidgets.QLabel(Dialog)
        self.label_8.setGeometry(QtCore.QRect(704, 410, 81, 18))
        self.label_8.setObjectName("label_8")
        self.label_9 = QtWidgets.QLabel(Dialog)
        self.label_9.setGeometry(QtCore.QRect(1162, 440, 111, 20))
        self.label_9.setObjectName("label_9")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Fund Information Search Engine"))
        self.label.setText(_translate("Dialog", "                                 基金代码"))
        self.pushButton.setText(_translate("Dialog", "确认"))
        self.deleteOne.setText(_translate("Dialog", "删除一个"))
        self.deleteAll.setText(_translate("Dialog", "删除全部"))
        self.label_2.setText(_translate("Dialog", "基金基本信息"))
        self.label_3.setText(_translate("Dialog", "实时估算涨跌幅度"))
        self.label_4.setText(_translate("Dialog", "持仓占比信息"))
        self.label_5.setText(_translate("Dialog", "不同类型占比信息"))
        self.label_6.setText(_translate("Dialog", "阶段涨幅"))
        self.label_7.setText(_translate("Dialog", "历史更新持仓日期"))
        self.label_8.setText(_translate("Dialog", "行业分布信息"))
        self.label_9.setText(_translate("Dialog", "历史净值和涨跌幅"))


class MyForm(QDialog):
        def __init__(self):
            super().__init__()
            self.ui = Ui_Dialog()
            self.ui.setupUi(self)
        #   self.ui.listWidget.addItem(str(ef.fund.get_base_info('000689')))
            self.ui.pushButton.clicked.connect(self.addlist)
        #   self.ui.pushButtonEdit.clicked.connect(self.editlist)
            self.ui.deleteOne.clicked.connect(self.delitem)
            self.ui.deleteAll.clicked.connect(self.delallitems)
            self.show()

        def addlist(self):
            code = self.ui.lineEdit.text()
            self.ui.Information.addItem(str(ef.fund.get_base_info(code)))
            self.ui.Realtime.addItem(str(ef.fund.get_realtime_increase_rate(code)))
            self.ui.inverst.addItem(str(ef.fund.get_inverst_position(code)))
            self.ui.types.addItem(str(ef.fund.get_types_persentage(code)))
            self.ui.period.addItem(str(ef.fund.get_period_change(code)))
            self.ui.public_2.addItem(str(ef.fund.get_public_dates(code)))
            self.ui.industry.addItem(str(ef.fund.get_industry_distribution(code)))
            self.ui.history.addItem(str(ef.fund.get_quote_history(code)))
            self.ui.lineEdit.setText('')
            self.ui.lineEdit.setFocus()

#       def editlist(self):
#           row = self.ui.listWidget.currentRow()
#           newtext, ok = QInputDialog.getText(self, "Enter new text", "Enter new text")
#           if ok and (len(newtext) != 0):
#               self.ui.listWidget.takeItem(self.ui.listWidget.currentRow())
#               self.ui.listWidget.insertItem(row,QListWidgetItem(newtext))

        def delitem(self):
            self.ui.Information.takeItem(self.ui.Information.currentRow())
            self.ui.Realtime.takeItem(self.ui.Realtime.currentRow())
            self.ui.inverst.takeItem(self.ui.inverst.currentRow())
            self.ui.types.takeItem(self.ui.types.currentRow())
            self.ui.period.takeItem(self.ui.period.currentRow())
            self.ui.public_2.takeItem(self.ui.public_2.currentRow())
            self.ui.industry.takeItem(self.ui.industry.currentRow())
            self.ui.history.takeItem(self.ui.history.currentRow())

        def delallitems(self):
            self.ui.Information.clear()
            self.ui.Realtime.clear()
            self.ui.inverst.clear()
            self.ui.types.clear()
            self.ui.period.clear()
            self.ui.public_2.clear()
            self.ui.industry.clear()
            self.ui.history.clear()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    w = MyForm()
    w.show()
    sys.exit(app.exec_())
#   self.ui.listWidget.addItem(str(ef.fund.get_base_info('000689'))) #   self.ui.pushButtonEdit.clicked.connect(self.editlist) #       def editlist(self): #           row = self.ui.listWidget.currentRow() #           newtext, ok = QInputDialog.getText(self, "Enter new text", "Enter new text") #           if ok and (len(newtext) != 0): #               self.ui.listWidget.takeItem(self.ui.listWidget.currentRow()) #               self.ui.listWidget.insertItem(row,QListWidgetItem(newtext))