def read_multi(): open_time, close_time = utils.get_open_close_time() for symbol in config.type_list: check_data(open_time, close_time, symbol) while True: time.sleep(12) try: for symbol in config.type_list: time.sleep(1) klines = query_data(url % symbol) #print klines for k in klines: try: save_or_update(k, symbol) except Exception as e: print k, e traceback.print_exc() except Exception as e: traceback.print_exc() print e
# recv_data.check_data(open_time, close_time, 'SCcu0001') # time.sleep(1) # # calc.calc_sub_price(open_time, close_time) # merge.merge(open_time, close_time) # begin = datetime.datetime(year=2017, month=1,day=1,hour=9,minute=0,second=0,microsecond=0) end = datetime.datetime(year=2017, month=10,day=10,hour=1,minute=0,second=0,microsecond=0) # begin = read_date("开盘") # end = read_date("收盘") delta = datetime.timedelta(hours=12) delta1 = datetime.timedelta(days=4) while begin < end: time.sleep(1) open_time, close_time = utils.get_open_close_time(begin) if not utils.is_trading_day(open_time): begin += delta continue res = recv_data.check_data(open_time, close_time, config.ACTUAL_GOODS) if not res: print "there is no data between %s - %s" %(open_time, close_time) begin += delta continue time.sleep(1) res = recv_data.check_data(open_time, close_time, config.FUTURES) if not res: cur = dbutil.get_cursor()