# top_dif['dff'] = top_dif['dff'].apply(lambda x: x * 2 if x > 0 else x)
                        top_dif = top_dif[top_dif.lvol > ct.LvolumeSize]
                        top_dif['dff'] = top_dif['dff'].apply(lambda x: x * 2 if x < 0 else x)
                        if 'couts' in top_dif.columns.values:
                            top_dif = top_dif.sort_values(by=['dff', 'percent', 'volume', 'couts', 'ratio'],
                                                          ascending=[1, 0, 0, 1, 1])
                        else:
                            top_dif = top_dif.sort_values(by=['dff', 'percent', 'ratio'], ascending=[1, 0, 1])

                    # top_all=top_all.sort_values(by=['percent','dff','couts','ratio'],ascending=[0,0,1,1])
                    # print cct.format_for_print(top_dif[:10])
                    # top_dd = pd.concat([top_dif[:5],top_temp[:3],top_dif[-3:],top_temp[-3:]], axis=0)
                    if percent_status == 'y' and (
                            cct.get_now_time_int() > 915 and cct.get_now_time_int() < 1505) and ptype == 'low':
                        top_dif = top_dif[top_dif.percent >= 0]
                        top_temp = stf.filterPowerCount(top_dif,ct.PowerCount)
                        top_end = top_dif[-5:].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)

                    # elif percent_status == 'y' and cct.get_now_time_int() > 935 and ptype == 'high' :
                    elif ptype == 'low':
                        # top_dif = top_dif[top_dif.percent >= 0]
                        top_temp = stf.filterPowerCount(top_dif,ct.PowerCount)
                        top_end = top_dif[-5:].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)
                    else:
                        # top_dif = top_dif[top_dif.percent >= 0]
                        top_end = top_dif[:5].copy()
                        top_temp = top_dif[-ct.PowerCount:].copy()
예제 #2
0
                top_all = top_all.sort_values(by=ct.Monitor_sort_count,
                                              ascending=[0, 0, 0, 0, 1])
                # top_all = top_all.sort_values(by=[ 'couts'], ascending=[0])
                # top_all=top_all.sort_values(by=['dff','percent','couts','ratio'],ascending=[0,0,1,1])

                # top_all=top_all.sort_values(by=['dff','couts'],ascending=[0,0])
                # top_all=top_all.sort_values(by=['dff','percent','couts','ratio'],ascending=[0,0,1,1])

                # print top_all
                # print pt.PrettyTable([''] + list(top_all.columns))
                # print tbl.tabulate(top_all,headers='keys', tablefmt='psql')
                # print tbl.tabulate(top_all,headers='keys', tablefmt='orgtbl')
                # print cct.format_for_print(top_all)
                # print top_all[:10]

                top_temp = stf.filterPowerCount(top_all, ct.PowerCount)
                top_temp = pct.powerCompute_df(top_temp, dl=ct.PowerCountdl)
                goldstock = len(
                    top_all[(top_all.buy >= top_all.lhigh * 0.99)
                            & (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)