コード例 #1
0
                log.debug('dif6 vol:%s' % (top_dif[:1].volume))

                log.debug('dif6 vol>lvol:%s' % len(top_dif))

                # top_dif = top_dif[top_dif.buy >= top_dif.open*0.99]
                # log.debug('dif5 buy>open:%s'%len(top_dif))
                # top_dif = top_dif[top_dif.trade >= top_dif.buy]

                # df['volume']= df['volume'].apply(lambda x:x/100)


                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:
コード例 #2
0
                        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)
                                    ])

                    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)
                    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(),
コード例 #3
0
ファイル: sina_Monitor.py プロジェクト: johnsonhongyi/pyQuant
                    top_all = top_all[top_all["llow"] > 0]
                    log.info("df:%s" % top_all[:1])
                    radio_t = cct.get_work_time_ratio()
                    log.debug("Second:vol/vol/:%s" % radio_t)
                    # top_dif['volume'] = top_dif['volume'].apply(lambda x: round(x / radio_t, 1))
                    log.debug("top_diff:vol")
                    top_all["volume"] = map(
                        lambda x, y: round(x / y / radio_t, 1), top_all["volume"].values, top_all["lvol"].values
                    )

                    # 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:
コード例 #4
0
                log.debug('dif6 vol>lvol:%s' % len(top_dif))

                # top_dif = top_dif[top_dif.buy >= top_dif.open*0.99]
                # log.debug('dif5 buy>open:%s'%len(top_dif))
                # top_dif = top_dif[top_dif.trade >= top_dif.buy]

                # df['volume']= df['volume'].apply(lambda x:x/100)

                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', 'percent', 'volume', 'counts', 'ratio'],
                        ascending=[0, 0, 0, 1, 0])
                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 top_all.loc['000025',:]
                # print "staus",status

                if status:
コード例 #5
0
                    # 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 = top_dif[:ct.PowerCount].copy()
                        top_end = top_dif[-5:].copy()
                        top_temp = pct.powerCompute_df(top_temp, dl=ct.PowerCountdl, talib=True)
                        top_end = pct.powerCompute_df(top_end, dl=ct.PowerCountdl, talib=True)
                    else:
                        # top_dif = top_dif[top_dif.percent >= 0]
                        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)
                        top_end = pct.powerCompute_df(top_end, dl=ct.PowerCountdl, talib=True)

                    cct.set_console(width, height,
                                    title=[du_date, 'dT:%s' % cct.get_time_to_date(time_s), 'G:%s' % goldstock,
                                           'zxg: %s' % (blkname)])

                    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)
                    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 %0.1f%%" % (float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp), round(len(top_temp) / now_count * 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)
コード例 #6
0
                    # print "Good Morning!!!"
                    top_dif = top_dif.sort_values(
                        by=['dff', 'percent', 'ratio'], ascending=[0, 0, 1])

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

                top_temp = top_dif[:ct.PowerCount].copy()
                top_temp = pct.powerCompute_df(top_temp, dl=ct.PowerCountdl)
                goldstock = len(
                    top_dif[(top_dif.buy >= top_dif.lhigh * 0.99)
                            & (top_dif.buy >= top_dif.llastp * 0.99)])

                cct.set_console(width,
                                height,
                                title=[
                                    'dT:%s' % cct.get_time_to_date(time_s),
                                    'G:%s' % len(top_dif),
                                    'zxg: %s' % (blkname)
                                ])

                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) / now_count * 100, 1))