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 day_t in d_hist.index:
        dl = d_hist.drop(day_t).index
    else:
        dl = d_hist.index
    # 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
示例#2
0
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
                                        '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(),
                        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)
                        else:
                            top_temp = top_temp.sort_values(
                                by=eval(market_sort_value),
                                ascending=market_sort_value_key)
示例#4
0
                        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)
                        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']][:10]
                        # 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]
示例#5
0
                                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))
                if 'op' in top_temp.columns:

                    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.loc[:,ct.MonitorMarket_format_buy]
                # else:
                #     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])