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]), len(top_dif))),
                # print "Rt:%0.3f" % (float(time.time() - time_Rt))
                print "Rt:%0.1f dT:%s" % (float(time.time() - time_Rt),cct.get_time_to_date(time_s))
                if 'counts' in top_dif.columns.values:
                    top_dif = top_dif.sort_values(by=['diff', 'volume', 'percent', 'counts', 'ratio'],
                                                  ascending=[0, 0, 0, 1, 1])
                else:
                    # print "Good Morning!!!"
                    top_dif = top_dif.sort_values(by=['diff', 'percent', 'ratio'], ascending=[0, 0, 1])

                # top_all=top_all.sort_values(by=['percent','diff','counts','ratio'],ascending=[0,0,1,1])
                # print rl.format_for_print(top_dif[:10])
                print rl.format_for_print(top_dif[:10])
                # print top_all.loc['000025',:]
                # print "staus",status

                if status:
                    for code in top_dif[:10].index:
                        code = re.findall('(\d+)', code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
                            # print top_all[top_all.low.values==0]

                            # else:
                            #     print "\t No RealTime Data"
            else:
                print "\tNo Data"
                    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 = pd.concat([top_temp[:10], top_end], axis=0)
                        top_dd = top_dd.drop_duplicates()
                        top_dd = top_dd.loc[:, ct.Duration_format_buy]
                    else:
                        # top_temp = top_temp[ (top_temp['ma5d'] > top_temp['ma10d']) & (top_temp['trade'] > top_temp['ma10d']) ][:10]
                        # top_temp = top_temp[top_temp['trade'] > top_temp['ma10d']]

                        top_dd = pd.concat([top_temp[:10], top_end], axis=0)
                        top_dd = top_dd.drop_duplicates()
                        top_dd = top_dd.loc[:, ct.Duration_format_trade]
                    print rl.format_for_print(top_dd)
                    # dfgui.show(top_dif)
                # if cct.get_now_time_int() < 930 or cct.get_now_time_int() > 1505 or (cct.get_now_time_int() > 1125 and cct.get_now_time_int() < 1505):
                # print rl.format_for_print(top_dif[-10:])
                # print top_all.loc['000025',:]
                # print "staus",status

                if status:
                    for code in top_dd[:10].index:
                        code = re.findall('(\d+)', code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
                            # print top_all[top_all.low.values==0]

                            # else:
                    # top_all = top_all[top_all.prev_p >= top_all.lhigh]
                    top_all = top_all.loc[
                        :, ["name", "percent", "diff", "counts", "volume", "trade", "prev_p", "ratio"]
                    ]

                print "G:%s dt:%s" % (len(top_all), cct.get_time_to_date(time_s))
                top_all = top_all.sort_values(by=["diff", "counts", "volume", "ratio"], ascending=[0, 0, 0, 1])
                # top_all=top_all.sort_values(by=['percent','diff','counts','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 rl.format_for_print(top_all)
                # print top_all[:10]
                print rl.format_for_print(top_all[:10])
                # print "staus",status
                if status:
                    for code in top_all[:10].index:
                        code = re.findall("(\d+)", code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
                top_all = top_bak
                del top_bak
                gc.collect()

            else:
                print "no data"
            int_time = cct.get_now_time_int()
            if cct.get_work_time():
Exemple #4
0
                        if duration_date > ct.duration_date_sort:
                            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']) ]
                    #     top_temp = top_temp.loc[:,ct.MonitorMarket_format_buy]
                    # else:
                    #     # top_temp = top_temp[ (top_temp['ma5d'] > top_temp['ma10d']) & (top_temp['buy'] > top_temp['ma10d']) ]
                    #     top_temp = top_temp.loc[:,ct.MonitorMarket_format_buy]
                    print rl.format_for_print(
                        top_temp.loc[:, ct.MonitorMarket_format_buy][:10])

                # print rl.format_for_print(top_dif[:10])
                # print top_all.loc['000025',:]
                # print "staus",status

                if status:
                    for code in top_dif[:10].index:
                        code = re.findall('(\d+)', code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
                            # print top_all[top_all.low.values==0]

                            # else:
                            #     print "\t No RealTime Data"
                    else:
                        top_dif = top_dif.sort_values(by=["diff", "percent", "ratio"], ascending=[1, 0, 1])

                # top_all=top_all.sort_values(by=['percent','diff','counts','ratio'],ascending=[0,0,1,1])
                # print rl.format_for_print(top_dif[:10])
                # top_dd = pd.concat([top_dif[:5],top_temp[:3],top_dif[-3:],top_temp[-3:]], axis=0)
                top_dd = pd.concat([top_dif[:10], top_dif[-5:]], axis=0)
                if cct.get_now_time_int() < 930:
                    top_dd = top_dd.loc[
                        :, ["name", "buy", "diff", "volume", "percent", "ratio", "counts", "high", "lastp", "date"]
                    ]
                else:
                    top_dd = top_dd.loc[
                        :, ["name", "trade", "diff", "volume", "percent", "ratio", "counts", "high", "lastp", "date"]
                    ]
                print rl.format_for_print(top_dd)
                # if cct.get_now_time_int() < 930 or cct.get_now_time_int() > 1505 or (cct.get_now_time_int() > 1125 and cct.get_now_time_int() < 1505):
                # print rl.format_for_print(top_dif[-10:])
                # print top_all.loc['000025',:]
                # print "staus",status

                if status:
                    for code in top_dif[:10].index:
                        code = re.findall("(\d+)", code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
                            # print top_all[top_all.low.values==0]

                            # else:
                            #     print "\t No RealTime Data"
Exemple #6
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=eval(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_temp = top_temp.loc[:,ct.Monitor_format_trade]
                # else:
                #     top_temp = top_temp.loc[:,ct.Monitor_format_trade]
                print rl.format_for_print(
                    top_temp.loc[:, ct.Monitor_format_trade][:10])

                # print rl.format_for_print(top_all[:10])
                if status:
                    for code in top_all[:10].index:
                        code = re.findall('(\d+)', code)
                        if len(code) > 0:
                            code = code[0]
                            kind = sl.get_multiday_ave_compare_silent(code)
            else:
                # print top_now[:10]
                print "\tNo data"
            int_time = cct.get_now_time_int()
            if cct.get_work_time():
                if int_time < 930:
                    while 1: