def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == '': print("Usage: \n\ save all : save stock_day/xdxr/ index_day/ stock_list \n\ save X|x : save stock_day/xdxr/min index_day/min etf_day/min stock_list/block \n\ save day : save stock_day/xdxr index_day etf_day stock_list \n\ save min : save stock_min/xdxr index_min etf_min stock_list \n\ ------------------------------------------------------------ \n\ save stock_day : save stock_day \n\ save stock_xdxr : save stock_xdxr \n\ save stock_min : save stock_min \n\ save index_day : save index_day \n\ save index_min : save index_min \n\ save etf_day : save etf_day \n\ save etf_min : save etf_min \n\ save stock_list : save stock_list \n\ save stock_block: save stock_block \n\ save stock_info : save stock_info \n\ ----------------------------------------------------------\n\ if you just want to save daily data just\n\ save all+ save stock_block+save stock_info, it about 1G data \n\ if you want to save save the fully data including min level \n\ save x + save stock_info \n \n\ @yutiansut\n\ @QUANTAXIS\n\ ") else: arg = arg.split(' ') if len(arg) == 1 and arg[0] == 'all': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') # QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') # QA_SU_save_index_min('tdx') # QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') # QA_SU_save_stock_block('tdx') # QA_SU_save_stock_info('tdx') elif len(arg) == 1 and arg[0] == 'day': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') # QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') # QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == 'min': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) # QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') # QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') # QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') # QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] in ['X', 'x']: if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') # QA_SU_save_stock_info('tdx') else: for i in arg: if i == 'insert_user': if QA_Setting().client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting().client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) else: eval("QA_SU_save_%s('tdx')" % (i))
def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == '': print( "Usage: save all|X|x|day|min|insert_user|stock_day|stock_xdxr|stock_min|index_day|index_min|etf_day|etf_min|stock_list|stock_block" ) else: arg = arg.split(' ') if len(arg) == 1 and arg[0] == 'all': QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') #QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') #QA_SU_save_index_min('tdx') #QA_SU_save_etf_day('tdx') #QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == 'day': QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') #QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') #QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') #QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == 'min': QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) #QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') #QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') #QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] in ['X', 'x']: QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) QA_SU_save_stock_day('tdx') QA_SU_save_stock_xdxr('tdx') QA_SU_save_stock_min('tdx') QA_SU_save_index_day('tdx') QA_SU_save_index_min('tdx') QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') else: for i in arg: if i == 'insert_user': if QA_Setting.client.quantaxis.user_list.find({ 'username': '******' }).count() == 0: QA_Setting.client.quantaxis.user_list.insert({ 'username': '******', 'password': '******' }) else: eval("QA_SU_save_%s('tdx')" % (i))