def __saving_work(code, __coll): QA_util_log_info('##JOB07 Now Saving ETF_MIN ==== %s' % (str(code))) try: for type in ['1min', '5min', '15min', '30min', '60min']: ref_ = __coll.find({'code': str(code)[0:6], 'type': type}) end_time = str(now_time())[0:19] if ref_.count() > 0: start_time = ref_[ref_.count() - 1]['datetime'] else: start_time = '2015-01-01' QA_util_log_info( '##JOB07.%s Now Saving %s from %s to %s ==%s ' % (['1min', '5min', '15min', '30min', '60min' ].index(type), str(code), start_time, end_time, type)) if start_time != end_time: __data = QA_fetch_get_index_min(str(code), start_time, end_time, type) if len(__data) > 1: __coll.insert_many( QA_util_to_json_from_pandas(__data[1::])) except: __err.append(code)
def __saving_work(code, coll): QA_util_log_info('##JOB07 Now Saving ETF_MIN ==== {}'.format( str(code)), ui_log=ui_log) try: for type in ['1min', '5min', '15min', '30min', '60min']: ref_ = coll.find({'code': str(code)[0:6], 'type': type}) end_time = str(now_time())[0:19] if ref_.count() > 0: start_time = ref_[ref_.count() - 1]['datetime'] QA_util_log_info( '##JOB07.{} Now Saving {} from {} to {} =={} '.format( ['1min', '5min', '15min', '30min', '60min'].index(type), str(code), start_time, end_time, type), ui_log=ui_log) if start_time != end_time: __data = QA_fetch_get_index_min( str(code), start_time, end_time, type) if len(__data) > 1: coll.insert_many( QA_util_to_json_from_pandas(__data[1::])) else: start_time = '2015-01-01' QA_util_log_info( '##JOB07.{} Now Saving {} from {} to {} =={} '.format( ['1min', '5min', '15min', '30min', '60min'].index(type), str(code), start_time, end_time, type), ui_log=ui_log) if start_time != end_time: __data = QA_fetch_get_index_min( str(code), start_time, end_time, type) if len(__data) > 1: coll.insert_many( QA_util_to_json_from_pandas(__data)) except: err.append(code)