def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == "": self.print_save_usage() 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": "******" }) # TODO: 将ts还是tdx作为命令传入 # QA_SU_save_stock_day('ts') 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_list("tdx") QA_SU_save_etf_day('tdx') QA_SU_save_etf_xdxr("tdx") # QA_SU_save_etf_min('tdx') QA_SU_save_index_list("tdx") QA_SU_save_stock_list("tdx") QA_SU_save_stock_block("tdx") # QA_SU_save_stock_info('tdx') # QA_SU_save_report_calendar_his() # QA_SU_save_stock_divyield_his() 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_list("tdx") QA_SU_save_etf_day("tdx") QA_SU_save_etf_xdxr("tdx") # QA_SU_save_etf_min('tdx') QA_SU_save_index_list("tdx") QA_SU_save_stock_list("tdx") QA_SU_save_stock_block("tdx") # QA_SU_save_stock_divyield_day() # QA_SU_save_report_calendar_day() 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_list("tdx") # QA_SU_save_etf_day('tdx') QA_SU_save_etf_min("tdx") QA_SU_save_etf_xdxr("tdx") QA_SU_save_stock_list("tdx") QA_SU_save_index_list("tdx") # QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == "transaction": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_SU_save_index_transaction("tdx") QA_SU_save_stock_transaction("tdx") # 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_list('tdx') # QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') # QA_SU_save_stock_list('tdx') # QA_SU_save_index_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_list("tdx") QA_SU_save_etf_day("tdx") QA_SU_save_etf_min("tdx") QA_SU_save_etf_xdxr("tdx") QA_SU_save_stock_list("tdx") QA_SU_save_index_list("tdx") QA_SU_save_stock_block("tdx") QA_SU_save_future_list("tdx") # QA_SU_save_stock_info('tdx') elif len(arg) == 1 and arg[0] == "ts_all": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_inc() QA_ts_update_stock_basic() QA_ts_update_namechange() QA_ts_update_industry() QA_ts_update_daily_basic() elif len(arg) == 1 and arg[0] == "ts_financial": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_inc() elif len(arg) == 1 and arg[0] == "ts_stock_basic": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_stock_basic() elif len(arg) == 1 and arg[0] == "ts_industry": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_industry() elif len(arg) == 1 and arg[0] == "ts_daily": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_daily_basic() elif len(arg) == 1 and arg[0] == "ts_namechange": if (QA_Setting().client.quantaxis.user_list.find({ "username": "******" }).count() == 0): QA_Setting().client.quantaxis.user_list.insert({ "username": "******", "password": "******" }) QA_ts_update_namechange() elif len(arg) == 1 and arg[0] == 'ts_stock_day': QA_SU_save_stock_day('ts') elif len(arg) == 1 and arg[0] == 'ts_index_basic': QA_SU_save_index_basic('ts') elif len(arg) == 1 and arg[0] == 'ts_index_weight': QA_SU_save_index_weight('ts') elif len(arg) == 1 and arg[0] == "binance": QA_SU_save_binance_symbol() QA_SU_save_binance_1day() QA_SU_save_binance_1hour() QA_SU_save_binance_1min() elif len(arg) == 2 and arg[0] == "binance": if arg[1] == "all": QA_SU_save_binance_symbol() QA_SU_save_binance_1day() QA_SU_save_binance_1hour() QA_SU_save_binance("30m") QA_SU_save_binance("15m") QA_SU_save_binance("5m") QA_SU_save_binance_1min() else: frequency = arg[1] QA_SU_save_binance(frequency) elif len(arg) == 1 and arg[0] == "bitfinex": QA_SU_save_bitfinex_symbol() QA_SU_save_bitfinex_1day() QA_SU_save_bitfinex_1hour() QA_SU_save_bitfinex_1min() elif len(arg) == 2 and arg[0] == "bitfinex": if arg[1] == "all": QA_SU_save_bitfinex_symbol() QA_SU_save_bitfinex_1day() QA_SU_save_bitfinex_1hour() QA_SU_save_bitfinex("30m") QA_SU_save_bitfinex("15m") QA_SU_save_bitfinex("5m") QA_SU_save_bitfinex_1min() else: frequency = arg[1] QA_SU_save_bitfinex(frequency) elif len(arg) == 1 and arg[0] == "bitmex": QA_SU_save_bitmex_symbol() QA_SU_save_bitmex("1d") QA_SU_save_bitmex("1h") QA_SU_save_bitmex("1m") elif len(arg) == 1 and arg[0] == "huobi": QA_SU_save_huobi_symbol() QA_SU_save_huobi_1day() QA_SU_save_huobi_1hour() QA_SU_save_huobi_1min() elif len(arg) == 2 and arg[0] == "huobi": if arg[1] == "realtime": QA_SU_save_huobi_realtime() elif arg[1] == "all": QA_SU_save_huobi_symbol() QA_SU_save_huobi_1day() QA_SU_save_huobi_1hour() QA_SU_save_huobi("30min") QA_SU_save_huobi("15min") QA_SU_save_huobi("5min") QA_SU_save_huobi_1min() else: frequency = arg[1] QA_SU_save_huobi(frequency) elif len(arg) == 1 and arg[0] == "okex": QA_SU_save_okex_symbol() QA_SU_save_okex_1day() QA_SU_save_okex_1hour() QA_SU_save_okex_1min() elif len(arg) == 2 and arg[0] == "okex": if arg[1] == "all": QA_SU_save_okex_symbol() QA_SU_save_okex_1day() QA_SU_save_okex_1hour() QA_SU_save_okex("1800") QA_SU_save_okex("900") QA_SU_save_okex("300") QA_SU_save_okex_1min() else: frequency = arg[1] QA_SU_save_okex(frequency) elif len(arg) == 1 and arg[0] == "financialfiles": QA_SU_save_financialfiles() elif len(arg) == 1 and arg[0] == "future": QA_SU_save_future_day("tdx") QA_SU_save_future_min("tdx") QA_SU_save_future_list("tdx") elif len(arg) == 1 and arg[0] == "future_all": QA_SU_save_future_day_all("tdx") QA_SU_save_future_min_all("tdx") QA_SU_save_future_list("tdx") elif len(arg) == 1 and arg[0] == "50etf_option_day": QA_SU_save_option_50etf_day("tdx") elif len(arg) == 1 and arg[0] == "50etf_option_min": QA_SU_save_option_50etf_min("tdx") elif len(arg) == 1 and arg[0] == "300etf_option_day": QA_SU_save_option_300etf_day("tdx") elif len(arg) == 1 and arg[0] == "300etf_option_min": QA_SU_save_option_300etf_min("tdx") elif len(arg) == 1 and arg[0] == "option_commodity_day": QA_SU_save_option_commodity_day("tdx") elif len(arg) == 1 and arg[0] == "option_commodity_min": QA_SU_save_option_commodity_min("tdx") elif len(arg) == 1 and arg[0] in ["option"]: QA_SU_save_option_contract_list("tdx") QA_SU_save_option_day_all("tdx") QA_SU_save_option_min_all("tdx") elif len(arg) == 1 and arg[0] in ["option_contract_list"]: QA_SU_save_option_contract_list("tdx") elif len(arg) == 1 and arg[0] in ["option_day_all"]: QA_SU_save_option_day_all("tdx") elif len(arg) == 1 and arg[0] in ["option_min_all"]: QA_SU_save_option_min_all("tdx") elif len(arg) == 2 and arg[0] == "single_stock_day": QA_SU_save_single_stock_day(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_future_day": QA_SU_save_single_future_day(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_index_day": QA_SU_save_single_index_day(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_etf_day": QA_SU_save_single_etf_day(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_stock_min": QA_SU_save_single_stock_min(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_future_min": QA_SU_save_single_future_min(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_index_min": QA_SU_save_single_index_min(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_etf_min": QA_SU_save_single_etf_min(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_bond_day": QA_SU_save_single_bond_day(arg[1], "tdx") elif len(arg) == 2 and arg[0] == "single_bond_min": QA_SU_save_single_bond_min(arg[1], "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: try: eval("QA_SU_save_%s('tdx')" % (i)) except: print("❌命令格式不正确!") self.print_save_usage() self.lastcmd = ""
def do_save(self, arg): # 仅仅是为了初始化才在这里插入用户,如果想要注册用户,要到webkit底下注册 if arg == '': self.print_save_usage() 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': '******' } ) # TODO: 将ts还是tdx作为命令传入 # QA_SU_save_stock_day('ts') 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_list('tdx') # QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_index_list('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') # QA_SU_save_stock_info('tdx') # QA_SU_save_report_calendar_his() # QA_SU_save_stock_divyield_his() 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_list('tdx') QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') QA_SU_save_index_list('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_stock_block('tdx') # QA_SU_save_stock_divyield_day() # QA_SU_save_report_calendar_day() 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_list('tdx') # QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_index_list('tdx') # QA_SU_save_stock_block('tdx') elif len(arg) == 1 and arg[0] == 'transaction': if QA_Setting().client.quantaxis.user_list.find( {'username': '******'}).count() == 0: QA_Setting().client.quantaxis.user_list.insert( { 'username': '******', 'password': '******' } ) QA_SU_save_index_transaction('tdx') QA_SU_save_stock_transaction('tdx') # 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_list('tdx') # QA_SU_save_etf_day('tdx') # QA_SU_save_etf_min('tdx') # QA_SU_save_stock_list('tdx') # QA_SU_save_index_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_list('tdx') QA_SU_save_etf_day('tdx') QA_SU_save_etf_min('tdx') QA_SU_save_stock_list('tdx') QA_SU_save_index_list('tdx') QA_SU_save_stock_block('tdx') QA_SU_save_future_list('tdx') # QA_SU_save_stock_info('tdx') elif len(arg) == 1 and arg[0] == "binance": QA_SU_save_binance_symbol() QA_SU_save_binance_1day() QA_SU_save_binance_1hour() QA_SU_save_binance_1min() elif len(arg) == 2 and arg[0] == "binance": if (arg[1] == 'all'): QA_SU_save_binance_symbol() QA_SU_save_binance_1day() QA_SU_save_binance_1hour() QA_SU_save_binance('30m') QA_SU_save_binance('15m') QA_SU_save_binance('5m') QA_SU_save_binance_1min() else: frequency = arg[1] QA_SU_save_binance(frequency) elif len(arg) == 1 and arg[0] == "bitfinex": QA_SU_save_bitfinex_symbol() QA_SU_save_bitfinex_1day() QA_SU_save_bitfinex_1hour() QA_SU_save_bitfinex_1min() elif len(arg) == 2 and arg[0] == "bitfinex": if (arg[1] == 'all'): QA_SU_save_bitfinex_symbol() QA_SU_save_bitfinex_1day() QA_SU_save_bitfinex_1hour() QA_SU_save_bitfinex('30m') QA_SU_save_bitfinex('15m') QA_SU_save_bitfinex('5m') QA_SU_save_bitfinex_1min() else: frequency = arg[1] QA_SU_save_bitfinex(frequency) elif len(arg) == 1 and arg[0] == "bitmex": QA_SU_save_bitmex_symbol() QA_SU_save_bitmex('1d') QA_SU_save_bitmex('1h') QA_SU_save_bitmex('1m') elif len(arg) == 1 and arg[0] == "huobi": QA_SU_save_huobi_symbol() QA_SU_save_huobi_1day() QA_SU_save_huobi_1hour() QA_SU_save_huobi_1min() elif len(arg) == 2 and arg[0] == "huobi": if (arg[1] == 'realtime'): QA_SU_save_huobi_realtime() elif (arg[1] == 'all'): QA_SU_save_huobi_symbol() QA_SU_save_huobi_1day() QA_SU_save_huobi_1hour() QA_SU_save_huobi('30min') QA_SU_save_huobi('15min') QA_SU_save_huobi('5min') QA_SU_save_huobi_1min() else: frequency = arg[1] QA_SU_save_huobi(frequency) elif len(arg) == 1 and arg[0] == "okex": QA_SU_save_okex_symbol() QA_SU_save_okex_1day() QA_SU_save_okex_1hour() QA_SU_save_okex_1min() elif len(arg) == 2 and arg[0] == "okex": if (arg[1] == 'all'): QA_SU_save_okex_symbol() QA_SU_save_okex_1day() QA_SU_save_okex_1hour() QA_SU_save_okex('1800') QA_SU_save_okex('900') QA_SU_save_okex('300') QA_SU_save_okex_1min() else: frequency = arg[1] QA_SU_save_okex(frequency) elif len(arg) == 1 and arg[0] == "financialfiles": QA_SU_save_financialfiles() elif len(arg) == 1 and arg[0] == "future": QA_SU_save_future_day('tdx') QA_SU_save_future_min('tdx') QA_SU_save_future_list('tdx') elif len(arg) == 1 and arg[0] == "future_all": QA_SU_save_future_day_all('tdx') QA_SU_save_future_min_all('tdx') QA_SU_save_future_list('tdx') elif len(arg) == 1 and arg[0] == '50etf_option_day': QA_SU_save_option_50etf_day('tdx') elif len(arg) == 1 and arg[0] == '50etf_option_min': QA_SU_save_option_50etf_min('tdx') elif len(arg) == 1 and arg[0] == '300etf_option_day': QA_SU_save_option_300etf_day('tdx') elif len(arg) == 1 and arg[0] == '300etf_option_min': QA_SU_save_option_300etf_min('tdx') elif len(arg) == 1 and arg[0] == 'option_commodity_day': QA_SU_save_option_commodity_day('tdx') elif len(arg) == 1 and arg[0] == 'option_commodity_min': QA_SU_save_option_commodity_min('tdx') elif len(arg) == 1 and arg[0] in ['ox', 'OX', 'oX', 'Ox']: QA_SU_save_option_contract_list('tdx') QA_SU_save_option_50etf_day('tdx') QA_SU_save_option_50etf_min('tdx') QA_SU_save_option_300etf_day('tdx') QA_SU_save_option_300etf_min('tdx') QA_SU_save_option_commodity_day('tdx') QA_SU_save_option_commodity_min('tdx') elif len(arg) == 2 and arg[0] == 'single_stock_day': QA_SU_save_single_stock_day(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_index_day': QA_SU_save_single_index_day(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_etf_day': QA_SU_save_single_etf_day(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_stock_min': QA_SU_save_single_stock_min(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_index_min': QA_SU_save_single_index_min(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_etf_min': QA_SU_save_single_etf_min(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_bond_day': QA_SU_save_single_bond_day(arg[1], 'tdx') elif len(arg) == 2 and arg[0] == 'single_bond_min': QA_SU_save_single_bond_min(arg[1], '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: try: eval("QA_SU_save_%s('tdx')" % (i)) except: print("❌命令格式不正确!") self.print_save_usage()
QA_SU_save_huobi_1min() done = True elif (cmdline_args.sub != False) and \ (cmdline_args.sub == 'okex'): # 接收OKEx行情历史数据 from QUANTAXIS.QASU.save_okex import ( QA_SU_save_okex_symbol, QA_SU_save_okex, QA_SU_save_okex_1day, QA_SU_save_okex_1hour, QA_SU_save_okex_1min, ) QA_SU_save_okex_symbol() QA_SU_save_okex_1day() QA_SU_save_okex_1hour() QA_SU_save_okex('1800') QA_SU_save_okex('900') QA_SU_save_okex('300') QA_SU_save_okex_1min() done = True elif (cmdline_args.sub != False) and \ (cmdline_args.sub == 'binance'): # 接收币安行情历史数据 from QUANTAXIS.QASU.save_binance import ( QA_SU_save_binance_symbol, QA_SU_save_binance, QA_SU_save_binance_1day, QA_SU_save_binance_1hour, QA_SU_save_binance_1min, ) QA_SU_save_binance_symbol()