Exemplo n.º 1
0
  def isBiasMinOfDays(parseDay,days,id):

    path = Tools.getBiasDataPath()+'/' +id
    res = open(path,'r').read()
    dayList = BaseParser.getPastTradingDayList(parseDay,days)
    biasList = eval(res[26:-1])
    dataOfDays = {}
    for item in biasList:
      for d in dayList:
        if d == item['time']:
          dataOfDays[d] = eval(item['bias'])

    # 坏数据:个股交易日未必连续        
    if (len(dataOfDays)<1) or (len(dayList) != len(dataOfDays)):
      # print 'len(dataOfDays)<1) or (len(dayList) != len(dataOfDays)'
      return False


    # bias n日最低
    biasIsMin = True
    bias = float(dataOfDays[parseDay][1])
    for day,data in dataOfDays.items():
      theBias = float(dataOfDays[day][1])
      if theBias < bias:
        biasIsMin = False
        break

    if not biasIsMin:
      return False

    return True
Exemplo n.º 2
0
  def isBiasAllNegative(parseDay,id):
    path = Tools.getBiasDataPath()+'/' +id
    try:
      res = open(path,'r').read()
      if len(res) < 50:
        return False # 交由人工判断

      dayList = BaseParser.getPastTradingDayList(parseDay,2)
      biasList = eval(res[26:-1])
      dataOfDays = {}
      for item in biasList:
        for d in dayList:
          if d == item['time']:
            dataOfDays[d] = eval(item['bias'])
    except Exception, e:
      pass
      # print repr(e)
      return False