종목 전체를 가져와서 per 등의 지표로 순위를 메겨보려 했다.

종목을 전체 가져오는 건 성공..


  def getALLStockCode(self):
        # Creonapi 세팅
        obj = win32com.client.Dispatch("CpUtil.CpStockCode")
        numData = obj.GetCount()
        data = []
        for index in range(numData):
            tempData = []
            tempData.append(obj.GetData(0, index))
            data.append(tempData)
        return data
 

but..
문제가 생겨버렸다.

바로바로..

pywintypes.com_error: (-2147352567, '예외가 발생했습니다.', (0, None, 'Module:CpSysDib\nObj:MarketEye\nFun:SetInputValue\nType:1\nDescription:종목 개수는 200개를 초과할 수 없습니다.', None, 0, -2147024809), None)

코드는 이렇다.
200 으로 split 해서 가져와야되는건가


     def subMarketEye(self, m_InfoList, m_CodeList):

        obj = win32com.client.Dispatch("cpsysdib.MarketEye")
        obj.SetInputValue(0, m_InfoList) 
        obj.SetInputValue(1, m_CodeList) 
        obj.BlockRequest()

        numField=obj.GetHeaderValue(0) 
        print(m_CodeList.count())
        numData=obj.GetHeaderValue(2) 
        # nameField=obj.GetHeaderValue(1)
        # print('필드명:', nameField)
        data=[]
        for idx_x in range(numData):
            tempdata=[]
            for idx_y in range(numField):
                tempdata.append(obj.GetDataValue(idx_y, idx_x))
            data.append(tempdata)
        return data

 

+ Recent posts