Exemple #1
0
  def getBasicInfoById(id):
    '''
    31 成交量
    36 量比
    
    37 换手率
    38 市盈率
    43 市净率
    
    45 流通市值
    46 总市值
    '''

    data = []
    try:
      path = Tools.getBasicDirPath()+'/'+str(id)
      res = open(path,'r').read()
      res = res[41:-1]
      data = eval(res)['Value']
    except Exception, e:
      pass
    s += '<tr style='+style+'>'
    s +='<td>' + rg[0] + '</td>'
    s +='<td>' + str(num) + '</td>'
    s +='<td>' + str(per) + ' %</td>'
    s +='</tr>'
  s += '</table>'


  s +='</body>'
  s +='</html>'
  path = Tools.getReportDirPath()+'/pe_pb.html'
  open(path,'w').write(s)


if __name__ == '__main__':
  path = Tools.getBasicDirPath()

  csvPe = {}
  csvPb = {}
  csvCr = {}
  for root,dirs,files in os.walk(path):
      for f in files:
        try:
          if len(f) == 6:
            id = f
            info = BaseParser.BaseParser.getBasicInfoById(id)
            pe = float(info[38])
            pb = float(info[43])
            cr = float(info[37])

            # PE