def save_day(paralleled=True): """多进程保存日线数据 """ QA_SU_save_index_day('tdx', paralleled=paralleled) QA_SU_save_etf_list('tdx') QA_SU_save_etf_day('tdx', paralleled=paralleled) QA_SU_save_index_list('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') QA_SU_save_stock_day('tdx', paralleled=paralleled) QA_SU_save_stock_xdxr('tdx')
def test_save_day(self): from QUANTAXIS.QACmd import QA_SU_save_stock_day, QA_SU_save_index_day, QA_SU_save_etf_day, \ QA_SU_save_stock_xdxr, QA_SU_save_etf_list, QA_SU_save_index_list, QA_SU_save_stock_list, \ QA_SU_save_stock_block QA_SU_save_stock_day('tdx', paralleled=True) QA_SU_save_stock_xdxr('tdx') QA_SU_save_index_day('tdx', paralleled=True) QA_SU_save_etf_list('tdx') QA_SU_save_etf_day('tdx', paralleled=True) QA_SU_save_index_list('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx')
def test_QA_save_stock_xdxr_with_delete(self): """测试多线程QA_SU_save_stock_xdxrk """ # 删除部分数据(以startStr开头的股票) table = DATABASE.stock_xdxr startStr = "0000" codelist = QA.QA_fetch_stock_list().code.tolist() codelist = [i for i in codelist if i.startswith(startStr)] myquery = {"code": {"$regex": "^{}".format(startStr)}} x = table.delete_many(myquery) print(x.deleted_count, " documents deleted(记录被删除).") with self.assertRaises(Exception) as context: data1 = QA.QA_fetch_stock_xdxr(codelist[:10]) self.assertTrue('not found' in str(context.exception.args), "删除后,数据应为空") QA_SU_save_stock_xdxr('tdx', paralleled=True) print('start test_QA_SU_save_xdxr') data1 = QA.QA_fetch_stock_xdxr(codelist[:10]) self.assertTrue(len(data1) > 0, "未保存数据") print("read from DB:", data1) print('end test_QA_SU_save_xdxr')
def save_xdxr(parallele=True): # 使用mock多进程下载xdxr数据 QA_SU_save_stock_xdxr('tdx')