예제 #1
0
def get_all_hot():
    try:
        gold = {}
        goldl = []
        # df = ts.get_today_all()
        # top = df[df['changepercent'] > 6]
        # top = top[top['changepercent'] <11]
        # print "top:", len(top['code'])
        codes="000893,002351,000705,002451,002515,002279,002679,002761,600895,000532,002113,002438,600235,600210,600857".split(',')
        print codes
        # for code in top['code']:
        for code in codes:
            dtick = ts.get_today_ticks(code)
            d_hist = ema.getdata_ema_trend(code, '10', 'd')
            # print d_hist
            day_t = ema.get_today()
            # if len(dtick.index) == 0:
            #     dtick=d_hist[]
            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 len(td) > 0:
                    ep = td['amount'].sum() / td['volume'].sum()
                    ep_list.append(ep)
                    # print ("D: %s P: %s"%(da,ep))
            total_ave = ema.less_average(ep_list)
            all_max=max(ep_list)
            if len(dtick.index) > 0:
                ep = dtick['amount'].sum() / dtick['volume'].sum()
                if ep >= all_max:
                    gold[code] = d_hist
                    goldl.append(code)
                    print ("Gold:%s ep:%s ave:%s max:%s" % (code, ep, total_ave,all_max))

    except (IOError, EOFError, KeyboardInterrupt):
        # print "key"
        # print "break"
        print "why"
        return
예제 #2
0
import stock.JohhnsonUtil.emacount as ema

# get now hot 10
date_top = {}
# df = ts.get_today_all()
# top=df[df['changepercent'] > 9.9]

# for code in top['code']:
tick_mean = []

for code in ["601608"]:
    dtick = ts.get_today_ticks(code)
    d_hist = ema.getdata_ema_trend(code, "10", "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
    for da in dl.values:
        # print da
        td = ts.get_tick_data(code, da)
        # print td
        ep = td["amount"].sum() / td["volume"].sum()
        print ("D: %s P: %s" % (da, ep))
    ep = dtick["amount"].sum() / dtick["volume"].sum()
    print "today: ", ep
# print top_count