def get_multiday_ave_compare(code, dayl='10'): dtick = ts.get_today_ticks(code) d_hist = ema.getdata_ema_trend(code, dayl, 'd') # print d_hist day_t = ema.get_today() if d_hist is not None: if day_t in d_hist.index: dl = d_hist.drop(day_t).index else: dl = d_hist.index else: return 0 # print dl # print dl ep_list = [] for da in dl.values: # print da td = ts.get_tick_data(code, da) # print td if not type(td) == types.NoneType: ep = td['amount'].sum() / td['volume'].sum() ep_list.append(ep) print("D: %s P: %s" % (da[-5:], ep)) ave = ema.less_average(ep_list) if len(dtick.index) > 0: ep = dtick['amount'].sum() / dtick['volume'].sum() p_now = dtick['price'].values[0] * 100 if p_now > ave and ep > ave: print("GOLD:%s ep:%s UP:%s!!! A:%s %s !!!" % (code, ep, p_now, ave, cct.get_now_time())) elif p_now > ave and ep < ave: print("gold:%s ep:%s UP:%s! A:%s %s !" % (code, ep, p_now, ave, cct.get_now_time())) elif p_now < ave and ep > ave: print("down:%s ep:%s Dow:%s? A:%s %s ?" % (code, ep, p_now, ave, cct.get_now_time())) else: print("DOWN:%s ep:%s now:%s??? A:%s %s ???" % (code, ep, p_now, ave, cct.get_now_time())) return ave
top_end = top_dif[:5].copy() top_temp = top_dif[-ct.PowerCount:].copy() top_temp = pct.powerCompute_df(top_temp, dl=ct.PowerCountdl, talib=True, newdays=newdays) top_end = pct.powerCompute_df(top_end, dl=ct.PowerCountdl, talib=True, newdays=newdays) cct.set_console(width, height, title=[du_date, 'dT:%s' % cct.get_time_to_date(time_s), 'G:%s' % goldstock, 'zxg: %s' % (blkname+'-'+market_blk)]) top_all = tdd.get_powerdf_to_all(top_all, top_temp) top_all = tdd.get_powerdf_to_all(top_all, top_end) top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl,resample=resample) print("N:%s K:%s %s G:%s" % ( now_count, len(top_all[top_all['buy'] > 0]), len(top_now[top_now['volume'] <= 0]), goldstock)), print "Rt:%0.1f dT:%s N:%s T:%s %s%%" % (float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp), round(len(top_temp) / float(ct.PowerCount) * 100, 1)) # top_end = stf.getBollFilter(df=top_end, boll=ct.bollFilter,duration=ct.PowerCountdl) if 'op' in top_temp.columns: if cct.get_now_time_int() > ct.checkfilter_end_timeDu and (int(duration_date) > int(ct.duration_date_sort) or int(duration_date) < ct.duration_diff): top_temp = top_temp.sort_values(by=eval(market_sort_value), ascending=market_sort_value_key) else: top_temp = top_temp.sort_values(by=eval(market_sort_value), ascending=market_sort_value_key) if cct.get_now_time_int() > 915 and cct.get_now_time_int() < 935: # top_temp = top_temp[ (top_temp['ma5d'] > top_temp['ma10d']) & (top_temp['buy'] > top_temp['ma10d']) ][:10] top_dd = cct.combine_dataFrame(top_temp[:10], top_end,append=True, clean=True) # top_dd = top_dd.drop_duplicates() ct_Duration_format_Values = ct.get_Duration_format_Values(ct.Duration_format_buy, market_sort_value[:])
'zxg: %s' % (blkname+'-'+market_blk)]) # print len(top_all),top_all.shape top_all = tdd.get_powerdf_to_all(top_all, top_temp) top_all = tdd.get_powerdf_to_all(top_all, top_end) # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter,duration=ct.PowerCountdl, filter=True, percent=True, resample=resample) # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter,duration=ct.PowerCountdl, filter=True, percent=True, resample=resample) top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=True, ma5d=False, dl=14, percent=False, resample=resample, ene=False,cuminTrend=False) # top_end = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=False, ma5d=False, dl=14, percent=False, resample=resample, ene=False) print(("N:%s K:%s %s G:%s" % ( now_count, len(top_all[top_all['buy'] > 0]), len(top_now[top_now['volume'] <= 0]), goldstock)), end=' ') nhigh = top_temp[top_temp.close > top_temp.nhigh] if 'nhigh' in top_temp.columns.values else [] nlow = top_temp[top_temp.close > top_temp.nlow] if 'nlow' in top_temp.columns.values else [] print("Rt:%0.1f dT:%s N:%s T:%s %s%% nh:%s nlow:%s" % (float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp), round(len(top_temp) / float(ct.PowerCount) * 100, 1),len(nhigh),len(nlow))) # top_end = stf.getBollFilter(df=top_end, boll=ct.bollFilter,duration=ct.PowerCountdl,filter=False) if 'op' in top_temp.columns: # if ptype == 'low': # top_temp = top_temp.sort_values(by=ct.Duration_sort_op, # ascending=ct.Duration_sort_op_key) # else: # top_temp = top_temp.sort_values(by=ct.Duration_sort_high_op, # ascending=ct.Duration_sort_high_op_key) # top_temp=top_temp[top_temp.op >12] # top_temp = top_temp.sort_values(by=['ra', 'op'],ascending=[0, 0])[:10] # top_temp = top_temp.sort_values(by=['dff', 'op', 'ra', 'percent', 'ratio'], # ascending=[0, 0, 0, 0, 1])[:10] # top_temp = top_temp.sort_values(by=['op', 'ra', 'dff', 'percent', 'ratio'],
& (top_all.buy >= top_all.llastp * 0.99)]) # print "G:%s Rt:%0.1f dT:%s N:%s" % (len(top_all),float(time.time() - # time_Rt),cct.get_time_to_date(time_s),cct.get_now_time()) cct.set_console(width, height, title=[ 'dT:%s' % cct.get_time_to_date(time_s), 'G:%s' % len(top_all), 'zxg: %s' % (blkname + '-' + market_blk) ]) top_all = tdd.get_powerdf_to_all(top_all, top_temp) top_temp = stf.getBollFilter(df=top_temp, boll=1) print "G:%s Rt:%0.1f dT:%s N:%s T:%s" % ( goldstock, float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp)) if 'op' in top_temp.columns: # top_temp = top_temp.sort_values(by=['ra','op','couts'],ascending=[0, 0,0]) # top_temp = top_temp.sort_values(by=['dff', 'op', 'ra', 'percent', 'ratio'], # top_temp = top_temp.sort_values(by=ct.Monitor_sort_op, # ascending=ct.Monitor_sort_op_key) # top_temp = top_temp.sort_values(by=ct.Duration_percentdn_ra, # ascending=ct.Duration_percentdn_ra_key) # top_temp = top_temp.sort_values(by=ct.Duration_percent_op, # ascending=ct.Duration_percent_op_key) top_temp = top_temp.sort_values( by=(market_sort_value), ascending=market_sort_value_key) # top_temp = top_temp.sort_values(by=['op','ra','dff', 'percent', 'ratio'], ascending=[0,0,0, 0, 1]) # if cct.get_now_time_int() > 915 and cct.get_now_time_int() < 935:
top_all.buy >= top_all.lhigh * 0.99) & (top_all.buy >= top_all.llastp * 0.99)]) top_all=tdd.get_powerdf_to_all(top_all, top_temp) # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=False) # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=False, ma5d=False, dl=14, percent=False, resample='d') # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=True, ma5d=True, dl=14, percent=False, resample=resample) top_temp=stf.getBollFilter( df=top_temp, resample=resample, down=True) top_end=stf.getBollFilter( df=top_end, resample=resample, down=True) nhigh = top_temp[top_temp.close > top_temp.nhigh] if 'nhigh' in top_temp.columns else [] nlow = top_temp[top_temp.close > top_temp.nlow] if 'nlow' in top_temp.columns else [] print("G:%s Rt:%0.1f dT:%s N:%s T:%s nh:%s nlow:%s" % (goldstock, float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp),len(nhigh),len(nlow))) top_temp=top_temp.sort_values(by=(market_sort_value), ascending=market_sort_value_key) ct_MonitorMarket_Values=ct.get_Duration_format_Values( ct.Monitor_format_trade, market_sort_value[:2]) if len(st_key_sort.split()) < 2: f_sort=(st_key_sort.split()[0] + ' f ') else: if st_key_sort.find('f') > 0: f_sort=st_key_sort else: f_sort=' '.join(x for x in st_key_sort.split()[ :2]) + ' f ' + ' '.join(x for x in st_key_sort.split()[2:])
title=[ 'dT:%s' % cct.get_time_to_date(time_s), 'G:%s' % len(top_dif), 'zxg: %s' % (blkname + '-' + market_blk) ]) top_all = tdd.get_powerdf_to_all(top_all, top_temp) top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl) print("A:%s N:%s K:%s %s G:%s" % (df_count, now_count, len(top_all[top_all['buy'] > 0]), len(top_now[top_now['volume'] <= 0]), goldstock)), print "Rt:%0.1f dT:%s N:%s T:%s %s%%" % ( float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp), round(len(top_temp) / float(ct.PowerCount) * 100, 1)) if 'op' in top_temp.columns: top_temp = top_temp.sort_values( by=(market_sort_value), ascending=market_sort_value_key) if st_key_sort.split()[0] == 'x': top_temp = top_temp[top_temp.topR != 0] # if cct.get_now_time_int() > 915 and cct.get_now_time_int() < 935: # top_temp = top_temp.loc[:,ct.MonitorMarket_format_buy] # else: # top_temp = top_temp.loc[:,ct.MonitorMarket_format_buy] ct_MonitorMarket_Values = ct.get_Duration_format_Values(
cct.set_console(width, height, title=[du_date, 'dT:%s' % cct.get_time_to_date(time_s), 'G:%s' % goldstock, 'zxg: %s' % (blkname + '-' + market_blk)]) # top_all = tdd.get_powerdf_to_all(top_all, top_temp) top_all = tdd.get_powerdf_to_all(top_all, top_end) top_temp = stf.getBollFilter( df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, upper=True, resample=resample) # df=top_temp, boll=11, duration=ct.PowerCountdl, upper=False, resample=resample) # df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, upper=False, resample=resample) print("N:%s K:%s %s G:%s" % ( now_count, len(top_all[top_all['buy'] > 0]), len(top_now[top_now['volume'] <= 0]), goldstock)), print ("Rt:%0.1f dT:%s N:%s T:%s %s%%" % (float(time.time() - time_Rt), cct.get_time_to_date( time_s), cct.get_now_time(), len(top_temp), round(len(top_temp) / float(ct.PowerCount) * 100, 1))) # print round(len(top_temp)/now_count*100,1) # print len(top_temp)/now_count*100 # top_end = stf.getBollFilter(df=top_end, boll=ct.bollFilter,duration=ct.PowerCountdl) if 'op' in top_temp.columns: # if ptype == 'low': # top_temp = top_temp.sort_values(by=ct.Duration_sort_op, # ascending=ct.Duration_sort_op_key) # else: # top_temp = top_temp.sort_values(by=ct.Duration_sort_high_op, # ascending=ct.Duration_sort_high_op_key) # top_temp=top_temp[top_temp.op >12] # top_temp = top_temp.sort_values(by=['ra', 'op'],ascending=[0, 0])[:10] # top_temp = top_temp.sort_values(by=['dff', 'op', 'ra', 'percent', 'ratio'],