Example #1
0
File: sector.py Project: lite/deone
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabSector")

        mainLayout = QtGui.QHBoxLayout()
        
        vLayoutLeft = QtGui.QVBoxLayout()
        self.label_DX = QtGui.QLabel(self)
        vLayoutLeft.addWidget(self.label_DX)

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label_RQ = QtGui.QLabel(self)
        hLayoutQuery.addWidget(self.label_RQ)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)
    
        vLayoutLeft.addLayout(hLayoutQuery)
        
        self.tblWidgetBK = QueryTableWidget(self)
        self.tblWidgetBK.setObjectName("tblWidgetBK")
        vLayoutLeft.addWidget(self.tblWidgetBK)

        mainLayout.addLayout(vLayoutLeft)

        vLayoutRight = QtGui.QVBoxLayout()
        self.label_GG = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_GG)
        self.tblWidgetGG = QueryTableWidget(self)
        self.tblWidgetGG.setObjectName("tblWidgetGG")
        vLayoutRight.addWidget(self.tblWidgetGG)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutRight.addWidget(self.tblWidgetZS) 
        
        mainLayout.addLayout(vLayoutRight)

        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery, QtCore.SIGNAL("pressed()"), self.doQuery)
        #self.emit(QtCore.SIGNAL("selectionChanged()"))
        QtCore.QObject.connect(self.tblWidgetBK, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetBK_selectionChanged)
        QtCore.QObject.connect(self.tblWidgetGG, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetGG_selectionChanged)


        self.lineEdit.setText('2009-07-10')
        self.doQuery()
Example #2
0
File: stock.py Project: lite/deone
class StockWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)
        self.setObjectName("tabStock")
        
        mainLayout = QtGui.QVBoxLayout()
        
        hLayoutQuery = QtGui.QHBoxLayout()
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(20, 10, 46, 14))
        self.label.setObjectName("label")
        hLayoutQuery.addWidget(self.label)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()
        
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery, QtCore.SIGNAL("pressed()"), self.doQuery)

        self.lineEdit.setText('1')
        self.doQuery()

    def retranslateUi(self):
        self.label.setText(QtGui.QApplication.translate("MainWindow", "股票代码", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButtonQuery.setText(QtGui.QApplication.translate("MainWindow", "查询", None, QtGui.QApplication.UnicodeUTF8))
        
    def doQuery(self):
        print("called doQuery")
        code = str(self.lineEdit.text())
        #日期	股票代码	公司名称	开盘价格	最高价格	最低价格	收盘价格	成交量
        self.ohlc.query(u'select 日期,开盘价格,最高价格,最低价格,收盘价格,成交量 from StockHist where 股票代码=? order by 日期 asc'.encode('utf-8'), (code,))
        self.tbl.query(u'select * from StockHist where 股票代码=? order by 日期 desc'.encode('utf-8'), (code,))
        pass
Example #3
0
class MarketWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabMarket")

        mainLayout = QtGui.QVBoxLayout()
        
        hLayoutQuery = QtGui.QHBoxLayout()
        self.pushButtonMarketSH = QtGui.QPushButton(self)
        #self.pushButtonMarketSH.setGeometry(QtCore.QRect(50, 5, 75, 23))
        self.pushButtonMarketSH.setObjectName("pushButtonMarketSH")
        hLayoutQuery.addWidget(self.pushButtonMarketSH)

        self.pushButtonMarketSZ = QtGui.QPushButton(self)
        #self.pushButtonMarketSZ.setGeometry(QtCore.QRect(200, 5, 75, 23))
        self.pushButtonMarketSZ.setObjectName("pushButtonMarketSZ")
        hLayoutQuery.addWidget(self.pushButtonMarketSZ)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonMarketSH, QtCore.SIGNAL("pressed()"), self.doQueryMarketSH)
        QtCore.QObject.connect(self.pushButtonMarketSZ, QtCore.SIGNAL("pressed()"), self.doQueryMarketSZ)

        self.doQueryMarketSH()

    def retranslateUi(self):
        self.pushButtonMarketSZ.setText(QtGui.QApplication.translate("MainWindow", "深证成指", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButtonMarketSH.setText(QtGui.QApplication.translate("MainWindow", "上证指数", None, QtGui.QApplication.UnicodeUTF8))
        
    def doQueryMarketSH(self):
        print("called doQueryMarketSH")
        self.doQueryMarket('999999')
        
    def doQueryMarketSZ(self):
        print("called doQueryMarketSH")
        self.doQueryMarket('399001')

    def doQueryMarket(self, code):
        #日期	市场代码	开盘	最高	最低	收盘	成交量	上涨个股	下跌个股	平盘个股	交易类型I	交易类型II 	交易类型III	交易类型IV	风险指标	动能指标
        self.ohlc.query(u'select 日期,开盘,最高,最低,收盘,成交量 from Market where 市场代码=? order by 日期 asc'.encode('utf-8'), (code,))
        self.tbl.query(u'select * from Market where 市场代码=? order by 日期 desc'.encode('utf-8'), (code,))
Example #4
0
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabTrading")
        mainLayout = QtGui.QHBoxLayout()

        vLayoutOHLC = QtGui.QVBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        vLayoutOHLC.addWidget(self.ohlc)

        self.tblWidgetMarket = QueryTableWidget(self)
        self.tblWidgetMarket.setObjectName("tblWidgetMarket")
        vLayoutOHLC.addWidget(self.tblWidgetMarket)

        mainLayout.addLayout(vLayoutOHLC)

        vLayoutInfo = QtGui.QVBoxLayout()

        self.label_Title = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_Title)
        self.label_FX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_FX)
        self.tblWidgetFX = QueryTableWidget(self)
        self.tblWidgetFX.setObjectName("tblWidgetFX")
        vLayoutInfo.addWidget(self.tblWidgetFX)

        self.label_JY = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_JY)
        self.tblWidgetJY = QueryTableWidget(self)
        self.tblWidgetJY.setObjectName("tblWidgetJY")
        vLayoutInfo.addWidget(self.tblWidgetJY)

        self.label_XX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_XX)
        self.tblWidgetXX = QueryTableWidget(self)
        self.tblWidgetXX.setObjectName("tblWidgetXX")
        vLayoutInfo.addWidget(self.tblWidgetXX)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutInfo.addWidget(self.tblWidgetZS)

        mainLayout.addLayout(vLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.tblWidgetXX,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetXX_selectionChanged)
        self.init()
Example #5
0
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabTrading")
        mainLayout = QtGui.QHBoxLayout()
        
        vLayoutOHLC = QtGui.QVBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        vLayoutOHLC.addWidget(self.ohlc)

        self.tblWidgetMarket = QueryTableWidget(self)
        self.tblWidgetMarket.setObjectName("tblWidgetMarket")
        vLayoutOHLC.addWidget(self.tblWidgetMarket)

        mainLayout.addLayout(vLayoutOHLC)

        vLayoutInfo = QtGui.QVBoxLayout()
        
        self.label_Title = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_Title)
        self.label_FX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_FX)
        self.tblWidgetFX = QueryTableWidget(self)
        self.tblWidgetFX.setObjectName("tblWidgetFX")
        vLayoutInfo.addWidget(self.tblWidgetFX)

        self.label_JY = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_JY)
        self.tblWidgetJY = QueryTableWidget(self)
        self.tblWidgetJY.setObjectName("tblWidgetJY")
        vLayoutInfo.addWidget(self.tblWidgetJY)
        
        self.label_XX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_XX)
        self.tblWidgetXX = QueryTableWidget(self)
        self.tblWidgetXX.setObjectName("tblWidgetXX")
        vLayoutInfo.addWidget(self.tblWidgetXX)
        
        self.label_ZS = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutInfo.addWidget(self.tblWidgetZS)
        
        mainLayout.addLayout(vLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.tblWidgetXX, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetXX_selectionChanged)
        self.init()
Example #6
0
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)
        self.setObjectName("tabStock")

        mainLayout = QtGui.QVBoxLayout()

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(20, 10, 46, 14))
        self.label.setObjectName("label")
        hLayoutQuery.addWidget(self.label)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()

        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery,
                               QtCore.SIGNAL("pressed()"), self.doQuery)

        self.lineEdit.setText('1')
        self.doQuery()
Example #7
0
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabMarket")

        mainLayout = QtGui.QVBoxLayout()
        
        hLayoutQuery = QtGui.QHBoxLayout()
        self.pushButtonMarketSH = QtGui.QPushButton(self)
        #self.pushButtonMarketSH.setGeometry(QtCore.QRect(50, 5, 75, 23))
        self.pushButtonMarketSH.setObjectName("pushButtonMarketSH")
        hLayoutQuery.addWidget(self.pushButtonMarketSH)

        self.pushButtonMarketSZ = QtGui.QPushButton(self)
        #self.pushButtonMarketSZ.setGeometry(QtCore.QRect(200, 5, 75, 23))
        self.pushButtonMarketSZ.setObjectName("pushButtonMarketSZ")
        hLayoutQuery.addWidget(self.pushButtonMarketSZ)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonMarketSH, QtCore.SIGNAL("pressed()"), self.doQueryMarketSH)
        QtCore.QObject.connect(self.pushButtonMarketSZ, QtCore.SIGNAL("pressed()"), self.doQueryMarketSZ)

        self.doQueryMarketSH()
Example #8
0
File: stock.py Project: lite/deone
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)
        self.setObjectName("tabStock")
        
        mainLayout = QtGui.QVBoxLayout()
        
        hLayoutQuery = QtGui.QHBoxLayout()
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(20, 10, 46, 14))
        self.label.setObjectName("label")
        hLayoutQuery.addWidget(self.label)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()
        
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery, QtCore.SIGNAL("pressed()"), self.doQuery)

        self.lineEdit.setText('1')
        self.doQuery()
Example #9
0
class StockWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)
        self.setObjectName("tabStock")

        mainLayout = QtGui.QVBoxLayout()

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(20, 10, 46, 14))
        self.label.setObjectName("label")
        hLayoutQuery.addWidget(self.label)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        mainLayout.addLayout(hLayoutQuery)

        hLayoutInfo = QtGui.QHBoxLayout()

        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        hLayoutInfo.addWidget(self.ohlc)

        self.tbl = QueryTableWidget(self)
        self.tbl.setObjectName("QueryTableWidget")
        hLayoutInfo.addWidget(self.tbl)

        mainLayout.addLayout(hLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery,
                               QtCore.SIGNAL("pressed()"), self.doQuery)

        self.lineEdit.setText('1')
        self.doQuery()

    def retranslateUi(self):
        self.label.setText(
            QtGui.QApplication.translate("MainWindow", "股票代码", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.pushButtonQuery.setText(
            QtGui.QApplication.translate("MainWindow", "查询", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def doQuery(self):
        print("called doQuery")
        code = str(self.lineEdit.text())
        #日期	股票代码	公司名称	开盘价格	最高价格	最低价格	收盘价格	成交量
        self.ohlc.query(
            u'select 日期,开盘价格,最高价格,最低价格,收盘价格,成交量 from StockHist where 股票代码=? order by 日期 asc'
            .encode('utf-8'), (code, ))
        self.tbl.query(
            u'select * from StockHist where 股票代码=? order by 日期 desc'.encode(
                'utf-8'), (code, ))
        pass
Example #10
0
class TradingWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabTrading")
        mainLayout = QtGui.QHBoxLayout()
        
        vLayoutOHLC = QtGui.QVBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        vLayoutOHLC.addWidget(self.ohlc)

        self.tblWidgetMarket = QueryTableWidget(self)
        self.tblWidgetMarket.setObjectName("tblWidgetMarket")
        vLayoutOHLC.addWidget(self.tblWidgetMarket)

        mainLayout.addLayout(vLayoutOHLC)

        vLayoutInfo = QtGui.QVBoxLayout()
        
        self.label_Title = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_Title)
        self.label_FX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_FX)
        self.tblWidgetFX = QueryTableWidget(self)
        self.tblWidgetFX.setObjectName("tblWidgetFX")
        vLayoutInfo.addWidget(self.tblWidgetFX)

        self.label_JY = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_JY)
        self.tblWidgetJY = QueryTableWidget(self)
        self.tblWidgetJY.setObjectName("tblWidgetJY")
        vLayoutInfo.addWidget(self.tblWidgetJY)
        
        self.label_XX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_XX)
        self.tblWidgetXX = QueryTableWidget(self)
        self.tblWidgetXX.setObjectName("tblWidgetXX")
        vLayoutInfo.addWidget(self.tblWidgetXX)
        
        self.label_ZS = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutInfo.addWidget(self.tblWidgetZS)
        
        mainLayout.addLayout(vLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.tblWidgetXX, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetXX_selectionChanged)
        self.init()

    def retranslateUi(self):
        self.label_Title.setText(QtGui.QApplication.translate("MainWindow", "DeOne 量化策略交易模型", None, QtGui.QApplication.UnicodeUTF8))
        self.label_FX.setText(QtGui.QApplication.translate("MainWindow", "市场风险分析", None, QtGui.QApplication.UnicodeUTF8))
        self.label_JY.setText(QtGui.QApplication.translate("MainWindow", "交易数据", None, QtGui.QApplication.UnicodeUTF8))
        self.label_XX.setText(QtGui.QApplication.translate("MainWindow", "详细消息", None, QtGui.QApplication.UnicodeUTF8))
        self.label_ZS.setText(QtGui.QApplication.translate("MainWindow", "操作指示", None, QtGui.QApplication.UnicodeUTF8))

    def tblWidgetXX_selectionChanged(self):
        print("call tblWidgetXX_selectionChanged")
        row=self.tblWidgetXX.currentRow()
        code = str(self.tblWidgetXX.item(row,0).text())
        print(code)
        #日期	股票代码	公司名称	开盘价格	最高价格	最低价格	收盘价格	成交量
        self.ohlc.query(u'select 日期,开盘价格,最高价格,最低价格,收盘价格,成交量 from StockHist where 股票代码=? order by 日期 asc'.encode('utf-8'), (code,))
        self.tblWidgetZS.query(u'select 日期,初始买入,最低买入,建仓价位,目标价位,最高目标,止损价位 from Suggestion where 股票代码=? and 日期=?'.encode('utf-8'), (code, self.date,))
        
    def init(self):
        self.date = '2009-07-10'
        #日期	市场代码	开盘	最高	最低	收盘	成交量	上涨个股	下跌个股	平盘个股	交易类型I	交易类型II 	交易类型III	交易类型IV	风险指标	动能指标
        self.tblWidgetMarket.query(u'select 日期,市场代码,开盘,最高,最低,收盘,成交量,上涨个股,下跌个股,平盘个股 from Market where 日期=?'.encode('utf-8'), (self.date,))
        self.tblWidgetFX.query(u'select 日期,市场代码,风险指标,动能指标 from Market where 日期=?'.encode('utf-8'), (self.date,))
        self.tblWidgetJY.query(u'select 日期,市场代码,交易类型I,交易类型II,交易类型III,交易类型IV from Market where 日期=?'.encode('utf-8'), (self.date,))
        #日期	股票代码	公司名称	交易类型	初始买入	最低买入	建仓价位	目标价位	最高目标	止损价位
        self.tblWidgetXX.query(u'select 股票代码,公司名称,交易类型 from Suggestion where 日期=?'.encode('utf-8'), (self.date,))
Example #11
0
File: sector.py Project: lite/deone
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabSector")

        mainLayout = QtGui.QHBoxLayout()

        vLayoutLeft = QtGui.QVBoxLayout()
        self.label_DX = QtGui.QLabel(self)
        vLayoutLeft.addWidget(self.label_DX)

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label_RQ = QtGui.QLabel(self)
        hLayoutQuery.addWidget(self.label_RQ)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        vLayoutLeft.addLayout(hLayoutQuery)

        self.tblWidgetBK = QueryTableWidget(self)
        self.tblWidgetBK.setObjectName("tblWidgetBK")
        vLayoutLeft.addWidget(self.tblWidgetBK)

        mainLayout.addLayout(vLayoutLeft)

        vLayoutRight = QtGui.QVBoxLayout()
        self.label_GG = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_GG)
        self.tblWidgetGG = QueryTableWidget(self)
        self.tblWidgetGG.setObjectName("tblWidgetGG")
        vLayoutRight.addWidget(self.tblWidgetGG)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutRight.addWidget(self.tblWidgetZS)

        mainLayout.addLayout(vLayoutRight)

        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery,
                               QtCore.SIGNAL("pressed()"), self.doQuery)
        #self.emit(QtCore.SIGNAL("selectionChanged()"))
        QtCore.QObject.connect(self.tblWidgetBK,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetBK_selectionChanged)
        QtCore.QObject.connect(self.tblWidgetGG,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetGG_selectionChanged)

        self.lineEdit.setText('2009-07-10')
        self.doQuery()
Example #12
0
File: sector.py Project: lite/deone
class SectorWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabSector")

        mainLayout = QtGui.QHBoxLayout()

        vLayoutLeft = QtGui.QVBoxLayout()
        self.label_DX = QtGui.QLabel(self)
        vLayoutLeft.addWidget(self.label_DX)

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label_RQ = QtGui.QLabel(self)
        hLayoutQuery.addWidget(self.label_RQ)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)

        vLayoutLeft.addLayout(hLayoutQuery)

        self.tblWidgetBK = QueryTableWidget(self)
        self.tblWidgetBK.setObjectName("tblWidgetBK")
        vLayoutLeft.addWidget(self.tblWidgetBK)

        mainLayout.addLayout(vLayoutLeft)

        vLayoutRight = QtGui.QVBoxLayout()
        self.label_GG = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_GG)
        self.tblWidgetGG = QueryTableWidget(self)
        self.tblWidgetGG.setObjectName("tblWidgetGG")
        vLayoutRight.addWidget(self.tblWidgetGG)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutRight.addWidget(self.tblWidgetZS)

        mainLayout.addLayout(vLayoutRight)

        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery,
                               QtCore.SIGNAL("pressed()"), self.doQuery)
        #self.emit(QtCore.SIGNAL("selectionChanged()"))
        QtCore.QObject.connect(self.tblWidgetBK,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetBK_selectionChanged)
        QtCore.QObject.connect(self.tblWidgetGG,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetGG_selectionChanged)

        self.lineEdit.setText('2009-07-10')
        self.doQuery()

    def retranslateUi(self):
        self.label_DX.setText(
            QtGui.QApplication.translate("MainWindow", "板块动向", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_RQ.setText(
            QtGui.QApplication.translate("MainWindow", "交易日期", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.pushButtonQuery.setText(
            QtGui.QApplication.translate("MainWindow", "查询", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_GG.setText(
            QtGui.QApplication.translate("MainWindow", "板块个股", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_ZS.setText(
            QtGui.QApplication.translate("MainWindow", "操作指示", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def doQuery(self):
        print("called doQuery")
        date = str(self.lineEdit.text())
        #self.tblWidgetBK.query(u'select * from CategoryHist where 股票代码=?'.encode('utf-8'), (date,))
        self.tblWidgetBK.query(u'select * from CategoryHist'.encode('utf-8'),
                               ())
        pass

    def tblWidgetBK_selectionChanged(self):
        print("called tblWidgetBK_selectionChanged")
        row = self.tblWidgetBK.currentRow()
        code = str(self.tblWidgetBK.item(row, 0).text())
        print(code)
        #select * from StockHist where 股票代码 in (select 股票代码 from StockCategory where 板块代码='YH')
        self.tblWidgetGG.query(
            u'select * from StockHist where 股票代码 in (select 股票代码 from StockCategory where 板块代码=?) order by 日期 desc'
            .encode('utf-8'), (code, ))

    def tblWidgetGG_selectionChanged(self):
        print("called tblWidgetGG_selectionChanged")
        row = self.tblWidgetGG.currentRow()
        code = str(self.tblWidgetGG.item(row, 2).text())
        print(code)
        self.tblWidgetZS.query(
            u'select * from Suggestion where 股票代码=? order by 日期 desc'.encode(
                'utf-8'), (code, ))
Example #13
0
class TradingWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabTrading")
        mainLayout = QtGui.QHBoxLayout()

        vLayoutOHLC = QtGui.QVBoxLayout()
        self.ohlc = OHLCWidget(self)
        self.ohlc.setObjectName("OHLCWidget")
        vLayoutOHLC.addWidget(self.ohlc)

        self.tblWidgetMarket = QueryTableWidget(self)
        self.tblWidgetMarket.setObjectName("tblWidgetMarket")
        vLayoutOHLC.addWidget(self.tblWidgetMarket)

        mainLayout.addLayout(vLayoutOHLC)

        vLayoutInfo = QtGui.QVBoxLayout()

        self.label_Title = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_Title)
        self.label_FX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_FX)
        self.tblWidgetFX = QueryTableWidget(self)
        self.tblWidgetFX.setObjectName("tblWidgetFX")
        vLayoutInfo.addWidget(self.tblWidgetFX)

        self.label_JY = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_JY)
        self.tblWidgetJY = QueryTableWidget(self)
        self.tblWidgetJY.setObjectName("tblWidgetJY")
        vLayoutInfo.addWidget(self.tblWidgetJY)

        self.label_XX = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_XX)
        self.tblWidgetXX = QueryTableWidget(self)
        self.tblWidgetXX.setObjectName("tblWidgetXX")
        vLayoutInfo.addWidget(self.tblWidgetXX)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutInfo.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutInfo.addWidget(self.tblWidgetZS)

        mainLayout.addLayout(vLayoutInfo)
        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.tblWidgetXX,
                               QtCore.SIGNAL("selectionChanged()"),
                               self.tblWidgetXX_selectionChanged)
        self.init()

    def retranslateUi(self):
        self.label_Title.setText(
            QtGui.QApplication.translate("MainWindow", "DeOne 量化策略交易模型", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_FX.setText(
            QtGui.QApplication.translate("MainWindow", "市场风险分析", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_JY.setText(
            QtGui.QApplication.translate("MainWindow", "交易数据", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_XX.setText(
            QtGui.QApplication.translate("MainWindow", "详细消息", None,
                                         QtGui.QApplication.UnicodeUTF8))
        self.label_ZS.setText(
            QtGui.QApplication.translate("MainWindow", "操作指示", None,
                                         QtGui.QApplication.UnicodeUTF8))

    def tblWidgetXX_selectionChanged(self):
        print("call tblWidgetXX_selectionChanged")
        row = self.tblWidgetXX.currentRow()
        code = str(self.tblWidgetXX.item(row, 0).text())
        print(code)
        #日期	股票代码	公司名称	开盘价格	最高价格	最低价格	收盘价格	成交量
        self.ohlc.query(
            u'select 日期,开盘价格,最高价格,最低价格,收盘价格,成交量 from StockHist where 股票代码=? order by 日期 asc'
            .encode('utf-8'), (code, ))
        self.tblWidgetZS.query(
            u'select 日期,初始买入,最低买入,建仓价位,目标价位,最高目标,止损价位 from Suggestion where 股票代码=? and 日期=?'
            .encode('utf-8'), (
                code,
                self.date,
            ))

    def init(self):
        self.date = '2009-07-10'
        #日期	市场代码	开盘	最高	最低	收盘	成交量	上涨个股	下跌个股	平盘个股	交易类型I	交易类型II 	交易类型III	交易类型IV	风险指标	动能指标
        self.tblWidgetMarket.query(
            u'select 日期,市场代码,开盘,最高,最低,收盘,成交量,上涨个股,下跌个股,平盘个股 from Market where 日期=?'
            .encode('utf-8'), (self.date, ))
        self.tblWidgetFX.query(
            u'select 日期,市场代码,风险指标,动能指标 from Market where 日期=?'.encode('utf-8'),
            (self.date, ))
        self.tblWidgetJY.query(
            u'select 日期,市场代码,交易类型I,交易类型II,交易类型III,交易类型IV from Market where 日期=?'
            .encode('utf-8'), (self.date, ))
        #日期	股票代码	公司名称	交易类型	初始买入	最低买入	建仓价位	目标价位	最高目标	止损价位
        self.tblWidgetXX.query(
            u'select 股票代码,公司名称,交易类型 from Suggestion where 日期=?'.encode(
                'utf-8'), (self.date, ))
Example #14
0
File: sector.py Project: lite/deone
class SectorWidget(QtGui.QWidget):
    def __init__(self, parent):
        super(QtGui.QWidget, self).__init__(parent)

        self.setObjectName("tabSector")

        mainLayout = QtGui.QHBoxLayout()
        
        vLayoutLeft = QtGui.QVBoxLayout()
        self.label_DX = QtGui.QLabel(self)
        vLayoutLeft.addWidget(self.label_DX)

        hLayoutQuery = QtGui.QHBoxLayout()
        self.label_RQ = QtGui.QLabel(self)
        hLayoutQuery.addWidget(self.label_RQ)

        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(80, 0, 113, 20))
        self.lineEdit.setObjectName("lineEdit")
        hLayoutQuery.addWidget(self.lineEdit)

        self.pushButtonQuery = QtGui.QPushButton(self)
        self.pushButtonQuery.setGeometry(QtCore.QRect(210, 0, 75, 23))
        self.pushButtonQuery.setObjectName("pushButtonQuery")
        hLayoutQuery.addWidget(self.pushButtonQuery)
    
        vLayoutLeft.addLayout(hLayoutQuery)
        
        self.tblWidgetBK = QueryTableWidget(self)
        self.tblWidgetBK.setObjectName("tblWidgetBK")
        vLayoutLeft.addWidget(self.tblWidgetBK)

        mainLayout.addLayout(vLayoutLeft)

        vLayoutRight = QtGui.QVBoxLayout()
        self.label_GG = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_GG)
        self.tblWidgetGG = QueryTableWidget(self)
        self.tblWidgetGG.setObjectName("tblWidgetGG")
        vLayoutRight.addWidget(self.tblWidgetGG)

        self.label_ZS = QtGui.QLabel(self)
        vLayoutRight.addWidget(self.label_ZS)
        self.tblWidgetZS = QueryTableWidget(self)
        self.tblWidgetZS.setObjectName("tblWidgetZS")
        vLayoutRight.addWidget(self.tblWidgetZS) 
        
        mainLayout.addLayout(vLayoutRight)

        self.setLayout(mainLayout)

        self.retranslateUi()

        QtCore.QObject.connect(self.pushButtonQuery, QtCore.SIGNAL("pressed()"), self.doQuery)
        #self.emit(QtCore.SIGNAL("selectionChanged()"))
        QtCore.QObject.connect(self.tblWidgetBK, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetBK_selectionChanged)
        QtCore.QObject.connect(self.tblWidgetGG, QtCore.SIGNAL("selectionChanged()"), self.tblWidgetGG_selectionChanged)


        self.lineEdit.setText('2009-07-10')
        self.doQuery()

    def retranslateUi(self):
        self.label_DX.setText(QtGui.QApplication.translate("MainWindow", "板块动向", None, QtGui.QApplication.UnicodeUTF8))
        self.label_RQ.setText(QtGui.QApplication.translate("MainWindow", "交易日期", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButtonQuery.setText(QtGui.QApplication.translate("MainWindow", "查询", None, QtGui.QApplication.UnicodeUTF8))
        self.label_GG.setText(QtGui.QApplication.translate("MainWindow", "板块个股", None, QtGui.QApplication.UnicodeUTF8))
        self.label_ZS.setText(QtGui.QApplication.translate("MainWindow", "操作指示", None, QtGui.QApplication.UnicodeUTF8))
        
    def doQuery(self):
        print("called doQuery")
        date = str(self.lineEdit.text())
        #self.tblWidgetBK.query(u'select * from CategoryHist where 股票代码=?'.encode('utf-8'), (date,))
        self.tblWidgetBK.query(u'select * from CategoryHist'.encode('utf-8'), ())
        pass

    def tblWidgetBK_selectionChanged(self):
        print("called tblWidgetBK_selectionChanged")
        row=self.tblWidgetBK.currentRow()
        code = str(self.tblWidgetBK.item(row,0).text())
        print(code)
        #select * from StockHist where 股票代码 in (select 股票代码 from StockCategory where 板块代码='YH') 
        self.tblWidgetGG.query(u'select * from StockHist where 股票代码 in (select 股票代码 from StockCategory where 板块代码=?) order by 日期 desc'.encode('utf-8'), (code,))
        
    def tblWidgetGG_selectionChanged(self):
        print("called tblWidgetGG_selectionChanged")
        row=self.tblWidgetGG.currentRow()
        code = str(self.tblWidgetGG.item(row,2).text())
        print(code)
        self.tblWidgetZS.query(u'select * from Suggestion where 股票代码=? order by 日期 desc'.encode('utf-8'), (code,))