old_contents: # -*- coding: utf-8 -*-
  """
  Created on Tue Jun  6 09:28:17 2017
  
  @author: Administrator
  """
  
  import pandas as pd
  import ToolModule as tm
  #import datetime
  import FilterDataModule as fd
  
  def getData(code=None,startDate=None,endDate=None,ft=None):
      data_list = []
      code_list = []
      turnover_rate_list = []
      if code is None:
          allCode = fd.all_share_codes
      else:
          allCode = code
      #allCode = [x for x in allCode if (int(x) > 300999 or int(x) < 300000)]
      #print(len(allCode))
      for code in allCode:
          data = fd.getHisDataByCode(code,startDate,endDate)
          if isinstance(data,pd.DataFrame) and not data.empty and (ft is None or ft(data)):
              data = data[data.turnover > 0]
              turnover_rate_list.extend(list(data.turnover/data.turnover.min()))
              code_list.extend([code]*len(data))
              data_list.append(data)
              #print('==================')
              #print(data)
      #print(len(data_list))    
      frame = pd.concat(data_list)#,ignore_index=True)
      frame['code'] = code_list
      frame['turnover_rate'] = turnover_rate_list
      return frame
  
  #data = getData('300024','2017-07-04')
  data = getData(None,'2017-07-05','2017-07-04',ft=lambda x:x.loc['2017-07-05','p_change'] >= 10)
  data1 = data[data.p_change > 0]
  data2 = data1.loc['2017-07-05']
  data3 = data1.loc['2017-07-04']
  
  print(len(data2))
  print(len(data3))
new_contents: # -*- coding: utf-8 -*-
  """
  Created on Tue Jun  6 09:28:17 2017
  
  @author: Administrator
  """
  
  import pandas as pd
  import ToolModule as tm
  #import datetime
  import FilterDataModule as fd
  
  def getData(code=None,startDate=None,endDate=None,ft=None):
      data_list = []
      code_list = []
      turnover_rate_list = []
      if code is None:
          allCode = fd.all_share_codes
      else:
          allCode = code
      #allCode = [x for x in allCode if (int(x) > 300999 or int(x) < 300000)]
      #print(len(allCode))
      for code in allCode:
          data = fd.getHisDataByCode(code,startDate,endDate)
          if isinstance(data,pd.DataFrame) and not data.empty and (ft is None or ft(data)):
              data = data[data.turnover > 0]
              turnover_rate_list.extend(list(data.turnover/data.turnover.min()))
              code_list.extend([code]*len(data))
              data_list.append(data)
              #print('==================')
              #print(data)
      #print(len(data_list))    
      frame = pd.concat(data_list)#,ignore_index=True)
      frame['code'] = code_list
      frame['turnover_rate'] = turnover_rate_list
      return frame
  
  #data = getData('300024','2017-07-04')
  data = getData(None,'2017-07-05','2017-07-04')
  print(data)
subject: fix bugs