def QA_SU_save_stock_xdxr(client=QA_Setting.client):
client.quantaxis.drop_collection('stock_xdxr')
stock_list = QA_fetch_get_stock_time_to_market()
coll = client.quantaxis.stock_xdxr
coll.create_index([('code', pymongo.ASCENDING),
('date', pymongo.ASCENDING)])
err = []
def __saving_work(code, coll):
QA_util_log_info('##JOB02 Now Saving XDXR INFO ==== %s' % (str(code)))
try:
coll.insert_many(
QA_util_to_json_from_pandas(
QA_fetch_get_stock_xdxr(str(code))))
except:
err.append(str(code))
for i_ in range(len(stock_list)):
#__saving_work('000001')
QA_util_log_info('The %s of Total %s' % (i_, len(stock_list)))
QA_util_log_info('DOWNLOAD PROGRESS %s ' % str(
float(i_ / len(stock_list) * 100))[0:4] + '%')
__saving_work(stock_list.index[i_], coll)
if len(err) < 1:
QA_util_log_info('SUCCESS')
else:
QA_util_log_info('ERROR CODE \n ')
QA_util_log_info(err)
评论列表
文章目录