# 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()
                        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+'-'+market_blk)])

                    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,resample=resample)
                    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) / float(ct.PowerCount) * 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:
Beispiel #2
0
                # 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)
                top_temp = stf.getBollFilter(df=top_temp, boll=1)
                print "G:%s Rt:%0.1f dT:%s N:%s T:%s" % (
                    goldstock, float(time.time() - time_Rt),
                    cct.get_time_to_date(time_s), cct.get_now_time(),
                    len(top_temp))
                if 'op' in top_temp.columns:
                    # top_temp = top_temp.sort_values(by=['ra','op','couts'],ascending=[0, 0,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)
Beispiel #3
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 = stf.filterPowerCount(top_dif, ct.PowerCount)
                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 + '-' + market_blk)
                                ])

                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) / float(ct.PowerCount) * 100, 1))
Beispiel #4
0
                    top_all.buy >= top_all.lhigh * 0.99) & (top_all.buy >= top_all.llastp * 0.99)])

                top_all=tdd.get_powerdf_to_all(top_all, top_temp)

                # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=False)
                # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=False, ma5d=False, dl=14, percent=False, resample='d')
                # top_temp = stf.getBollFilter(df=top_temp, boll=ct.bollFilter, duration=ct.PowerCountdl, filter=True, ma5d=True, dl=14, percent=False, resample=resample)
                
                top_temp=stf.getBollFilter(
                    df=top_temp, resample=resample, down=True)
                top_end=stf.getBollFilter(
                    df=top_end, resample=resample, down=True)

                nhigh = top_temp[top_temp.close > top_temp.nhigh] if 'nhigh'  in top_temp.columns else []
                nlow = top_temp[top_temp.close > top_temp.nlow] if 'nlow'  in top_temp.columns else []
                print("G:%s Rt:%0.1f dT:%s N:%s T:%s nh:%s nlow:%s" % (goldstock, float(time.time() - time_Rt), cct.get_time_to_date(time_s), cct.get_now_time(), len(top_temp),len(nhigh),len(nlow)))

                top_temp=top_temp.sort_values(by=(market_sort_value),
                                                ascending=market_sort_value_key)
                ct_MonitorMarket_Values=ct.get_Duration_format_Values(
                    ct.Monitor_format_trade, market_sort_value[:2])

                if len(st_key_sort.split()) < 2:
                    f_sort=(st_key_sort.split()[0] + ' f ')
                else:
                    if st_key_sort.find('f') > 0:
                        f_sort=st_key_sort
                    else:
                        f_sort=' '.join(x for x in st_key_sort.split()[
                                          :2]) + ' f ' + ' '.join(x for x in st_key_sort.split()[2:])
                    if 'couts' in top_dif.columns.values:
                        top_dif = top_dif.sort_values(by=ct.Monitor_sort_count, ascending=[0, 0, 0, 1, 1])
                    else:
                        # 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])
                    # print cct.format_for_print(top_dif[:10])
                    top_temp = stf.filterPowerCount(top_dif,ct.PowerCount)
                    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+'-'+market_blk)])

                    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)), end=' ')
                    # print "Rt:%0.3f" % (float(time.time() - time_Rt))
                    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) / float(ct.PowerCount) * 100, 1)))
                    if 'op' in top_temp.columns:

                        top_temp = top_temp.sort_values(by=(market_sort_value),
                                                        ascending=market_sort_value_key)
                    #     top_temp = top_temp.loc[:,ct.MonitorMarket_format_buy]
                    
                    if st_key_sort.split()[0] == 'x':