コード例 #1
0
 def gen_rows(plate_type, stock_type):
     for elm in jo['data'][plate_type]:
         bdat = dict_selector(elm, mode='plain')
         bdat['plate_type'] = plate_type
         bdat['stock_type'] = stock_type
         for item in elm[stock_type]['items']:
             item.update(bdat)
             yield item
コード例 #2
0
 def pool_detail(self):
     url = self.flashapi + '/pool/detail?pool_name=limit_up'
     jo = self.get_json(url)
     # dic = flatten_json(jo)
     rows = []
     for elm in jo['data']:
         bdat = dict_selector(elm, mode='plain')
         for item in elm['surge_reason']['related_plates']:
             item.update(bdat)
             rows.append(item)
     df = pd.DataFrame.from_records(rows)
     if self.debug: pdb.set_trace()
     return df
コード例 #3
0
 def plate_data(self,plates):
     fields ='plate_id,plate_name,fund_flow,rise_count,fall_count,stay_count,limit_up_count,core_avg_pcp,core_avg_pcp_rank,core_avg_pcp_rank_change,top_n_stocks,bottom_n_stocks'
     url = self.flashapi+'/plate/data?fields={0}&plates={1}'.format(fields,','.join(plates))
     jo = self.get_json(url)
     rows = []
     dic = flatten_json(jo)
     for plate_id,elm in jo['data'].items():
         bdat = dict_selector(elm,mode='plain')
         bdat['key_plate'] = plate_id
         for item in elm['bottom_n_stocks']['items']:
             item.update(bdat)
             rows.append(item)
     df = pd.DataFrame.from_records(rows)
     if self.debug: pdb.set_trace()
     return df