Esempio n. 1
0
    def makeAllStockLogData(self) :
        from cxStockMgr import cxStockMgr
        from cxCybosPlus    import cxCpCybos

        cpCybos = cxCpCybos()
        stockMgr = cxStockMgr()

        stockListLen = stockMgr.update()
        if stockListLen == 0 :
            print 'cxStockMgr.update : error occured.'
            return
        print 'stockListLen : ', stockListLen

        for stock in stockMgr.stockList :
            for option in ['Day','Minute','Tick'] :
                if self.makeLogData(stock[0], option) == False :
                    print '%s\t%s : makeLogData for %s : failed'%(stock[0],stock[1],option)
                    return
                    
                remainCount = cpCybos.GetLimitRemainCount(constants.LT_NONTRADE_REQUEST)
                remainTime = cpCybos.LimitRequestRemainTime()
                print 'remainCount : %d, remainTime : %d'%(remainCount,remainTime)
                if remainCount <= 1 :
                    print 'time.sleep for %d'%(remainTime)
                    time.sleep(remainTime)
Esempio n. 2
0
    def makeAllStockLogData(self) :
        from cxStockMgr import cxStockMgr
        from cxCybosPlus    import cxCpCybos

        cpCybos = cxCpCybos()
        stockMgr = cxStockMgr()

        stockListLen = stockMgr.update()
        if stockListLen == 0 :
            print 'cxStockMgr.update : error occured.'
            return
        print 'stockListLen : ', stockListLen

        for stock in stockMgr.stockList :
            for option in ['Day','Minute','Tick'] :
                if self.makeLogData(stock[0], option) == False :
                    print '%s\t%s : makeLogData for %s : failed'%(stock[0],stock[1],option)
                    return
                    
                remainCount = cpCybos.GetLimitRemainCount(constants.LT_NONTRADE_REQUEST)
                remainTime = cpCybos.LimitRequestRemainTime()
                print 'remainCount : %d, remainTime : %d'%(remainCount,remainTime)
                if remainCount <= 1 :
                    print 'time.sleep for %d'%(remainTime)
                    time.sleep(remainTime)
Esempio n. 3
0
    def loadLogData(self):
        stockMgr = cxStockMgr()

        if stockMgr.update() < 0:
            sys.stderr.write("cxStockDayData.loadLogData { stockMgr.update : failed }\n")
            del stockMgr
            return None

        stockList = stockMgr.getStockList()

        """
        for item in stockList :
            print item[0],      #stockCode
            print item[1],      #stockName
            print

        print len(stockList)    #2135
        """

        stockLogData = cxStockLogData()

        for stockCode, stockName, stockFullCode in stockList:
            dayLogData = []
            # sys.stdout.write('cxStockDayData.loadLogData { loading "%s ( %s )" daily logs.'\
            #                  %( stockCode, stockName ) )

            dayLogData = stockLogData.loadLogData(stockCode, u"Day")

            if dayLogData == None:
                sys.stderr.write(
                    'cxStockDayData.loadLogData { "%s (%s)" daily log : failed. }\n' % (stockCode, stockName)
                )
            else:
                dataList = []
                for i in range(0, len(dayLogData)):
                    dataList.append(
                        [
                            int(dayLogData[i][0]),  # 날짜
                            int(dayLogData[i][2]),  # 고가
                            int(dayLogData[i][3]),  # 저가
                            int(dayLogData[i][4]),  # 종가
                            int(dayLogData[i][5]),  # 거래량
                            int(dayLogData[i][6]),  # 거래대금
                        ]
                    )
                self.data.append([stockCode, dataList])

        sys.stdout.write("cxStockDayData.loadLogData { total len of data : %d }\n" % (len(self.data)))

        del stockLogData
        del stockMgr

        return self.data
Esempio n. 4
0
 def __init__(self) :
     print "hello cxCybosMain"
     self.stockMgr = cxStockMgr()
     if self.stockMgr.update() > 0 :
         print 'update stockMgr is OK!!'
Esempio n. 5
0
 def __init__(self) :
     print "hello cxCybosMain"
     self.stockMgr = cxStockMgr()
     if self.stockMgr.update() > 0 :
         print 'update stockMgr is OK!!'