def get_hot_count(changepercent): allTop = pd.DataFrame() for market in ct.SINA_Market_KEY: df = rd.get_sina_Market_json(market, False) # count=len(df.index) # print df[:1] top = df[df['percent'] > changepercent]['code'] topTen = df[df['percent'] > 9.9]['code'] crashTen = df[df['percent'] < -9.8]['code'] crash = df[df['percent'] < -changepercent]['code'] # top=df[ df['changepercent'] <6] print ( "%s topT: %s top>%s: %s " % ( f_print(4, market), f_print(3, len(topTen)), changepercent, f_print(4, len(top)))), ff = ffu.get_dfcfw_fund_flow(ct.DFCFW_FUND_FLOW_URL % ct.SINA_Market_KEY_TO_DFCFW[market]) if len(ff) > 0: zlr = float(ff['zlr']) zzb = float(ff['zzb']) # zt=str(ff['time']) print (u"crashT:%s crash<-%s:%s 流入: %0.1f亿 比: %0.1f%%" % ( f_print(4, len(crashTen)), changepercent, f_print(4, len(crash)), zlr, zzb)) else: print (u"crashT:%s crash<-%s:%s 流入: %0.1f亿 比: %0.1f%% %s" % ( f_print(4, len(crashTen)), changepercent, f_print(4, len(crash)))) allTop = allTop.append(df, ignore_index=True) df = allTop count = len(df.index) top = df[df['percent'] > changepercent]['code'] topTen = df[df['percent'] > 9.9]['code'] crashTen = df[df['percent'] < -9.8]['code'] crash = df[df['percent'] < -changepercent]['code'] print ( u"\t\tA:%s topT:%s top>%s:%s" % ( f_print(4, count), f_print(3, len(topTen)), changepercent, f_print(4, len(top)))), ff = ffu.get_dfcfw_fund_flow(ct.DFCFW_FUND_FLOW_ALL) if len(ff) > 0: zlr = float(ff['zlr']) zzb = float(ff['zzb']) zt = str(ff['time']) print (u"crashT:%s crash<-%s:%s 流入: %0.1f亿 占比: %0.1f%% %s" % ( f_print(3, len(crashTen)), changepercent, f_print(4, (len(crash))), zlr, zzb, zt)) else: print (u"crashT:%s crash<-%s:%s" % (f_print(3, len(crashTen)), changepercent, f_print(4, len(crash)))) return allTop
status = False vol = "0" type = "2" # cut_num=10000 First = True top_all = pd.DataFrame() time_s = time.time() delay_time = 1800 base_path = tdd.get_tdx_dir() block_path = tdd.get_tdx_dir_blocknew() + "063.blk" all_diffpath = tdd.get_tdx_dir_blocknew() + "062.blk" rongduan = 1 rongduan_status = True while 1: try: df = rl.get_sina_Market_json("all") top_now = rl.get_market_price_sina_dd_realTime(df, vol, type) df_count = len(df) now_count = len(top_now) del df gc.collect() radio_t = sl.get_work_time_ratio() time_Rt = time.time() log.debug("top_now:%s %s" % (top_now[:1], len(top_now))) if len(top_now) > 10 and top_now[:1].buy.values >= 0: time_d = time.time() # top_now=top_now[top_now['percent']>=0] if len(top_all) == 0: top_all = top_now # top_all['llow'] = 0 # top_all['lastp'] = 0