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: # print "\t No RealTime Data" else: print "\tNo Data" int_time = cct.get_now_time_int() if cct.get_work_time(): if int_time < ct.open_time: cct.sleep(ct.sleep_time) elif int_time < 930: cct.sleep((930 - int_time) * 55) # top_all = pd.DataFrame() time_s = time.time() else: cct.sleep(ct.duration_sleep_time) elif cct.get_work_duration(): while 1: cct.sleep(ct.duration_sleep_time) if cct.get_work_duration(): print ".", cct.sleep(ct.duration_sleep_time) else: # top_all = pd.DataFrame() cct.sleeprandom(60)
print("Please input 6 code:or exit") num_input = '' if num_input: if ave == None: ave = get_code_search_loop(num_input, code, dayl=days) else: ave = get_code_search_loop(num_input, code, dayl=days, ave=ave) code = num_input int_time = cct.get_now_time_int() if cct.get_work_time(): if int_time < 1000: cct.sleep(60) else: cct.sleep(ct.duration_sleep_time) int_time = cct.get_now_time_int() if cct.get_work_time(): if int_time < 930: while 1: cct.sleep(60) if cct.get_now_time_int() < 931: cct.sleep(60) print ".", else: # cct.sleep(random.randint(0, 30)) # print "." fibcount = 0 break
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" int_time = cct.get_now_time_int() if cct.get_work_time(): if int_time < ct.open_time: cct.sleep(ct.sleep_time) elif int_time < 930: cct.sleep((930 - int_time) * 55) top_all = pd.DataFrame() time_s = time.time() else: cct.sleep(60) elif cct.get_work_duration(): while 1: cct.sleep(60) if cct.get_work_duration(): print ".", cct.sleep(60) else: cct.sleeprandom(60) top_all = pd.DataFrame()
# args.start), end=cct.day8_to_day10(args.end), filter=args.filter, dl=args.dl) # print "code:%s op:%s ra/days:%s start:%s" % (code, op, str(ra) + '/' + str(days), st) # 'ra * fibl + rah*(abs(int(%s)-fibl))/fib +ma +kdj+rsi' boll, kdj, macd, rsi, ma, bollCT = getab.get_All_Count( args.code, dl=args.dl * 2, start=start, end=end, days=5) # print "" # print "ral,opl,fibl,oph,rah,fib,kdj,macd,rsi,ma=",ral,opl,fibl,oph,rah,fib,kdj,macd,rsi,ma # ra, fibl,rah,fib,ma,kdj,rsi # for x in [boll,kdj,macd,rsi,ma,bollCT,ra,fibl,rah,`]: # print type(x),x # print args.dl,ra,fibl,rah,op # print ra * fibl + rah*(abs(int(args.dl)-fibl))/fib +ma +kdj+rsi diff = eval(ct.powerdiff % (ct.PowerCountdl)) print "Diff:%.1f" % (diff) cct.sleep(0.1) # ts=time.time() # time.sleep(5) # print "%0.5f"%(time.time()-ts) elif code == 'q': sys.exit(0) elif code == 'h' or code == 'help': parser.print_help() else: # print "code error" # print '', pass except (KeyboardInterrupt) as e: # print "key" print "KeyboardInterrupt:", e
# 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: cct.sleep(60) if cct.get_now_time_int() < 931: cct.sleep(60) print ".", else: top_all = pd.DataFrame() time_s = time.time() print "." break else: cct.sleep(60) elif cct.get_work_duration(): while 1: cct.sleep(60) if cct.get_work_duration(): print ".",
# log.level = log.debug # error_handler = SyslogHandler('Sina-M-Log', level='ERROR') try: if cct.get_work_day_status() and cct.get_now_time_int() < 1505: # tdx_data=tdd.get_tdx_all_day_DayL_DF(market='cyb', dayl=1) print sina_data.Sina().get_stock_code_data('300006') tdx_data = rl.get_sina_Market_json('cyb') if len(tdx_data) < 1: raise KeyboardInterrupt("StopTime") else: print tdx_data[-2:] code = '300366' except (KeyboardInterrupt) as e: pass except (IOError, EOFError, Exception) as e: print "Error", e #traceback.print_exc() sleeptime = random.randint(5, 15) print "Error2sleep:%s" % (sleeptime) cct.sleep(sleeptime) ''' {symbol:"sz000001",code:"000001",name:"平安银行",trade:"0.00",pricechange:"0.000",changepercent:"0.000",buy:"12.36",sell:"12.36",settlement:"12.34",open:"0.00",high:"0.00",low:"0",volume:0,amount:0,ticktime:"09:17:55",per:7.133,pb:1.124,mktcap:17656906.355526,nmc:14566203.350486,turnoverratio:0}, {symbol:"sz000002",code:"000002",name:"万 科A",trade:"0.00",pricechange:"0.000",changepercent:"0.000",buy:"0.00",sell:"0.00",settlement:"24.43",open:"0.00",high:"0.00",low:"0",volume:0,amount:0,ticktime:"09:17:55",per:17.084,pb:3.035,mktcap:26996432.575,nmc:23746405.928119,turnoverratio:0}, python -m cProfile -s cumulative timing_functions.py http://www.jb51.net/article/63244.htm '''