Example #1
0
    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()
Example #2
0
    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 = ""
Example #3
0
    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':
                        '******'
                    })
                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_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_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_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_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_1day()
                QA_SU_save_binance_1min()
            elif len(arg) == 2 and arg[0] == "binance":
                frequency = arg[1]
                QA_SU_save_binance(frequency)
            elif len(arg) == 1 and arg[0] == "bitmex":
                QA_SU_save_bitmex_symbol()
                QA_SU_save_bitmex('1m')
                QA_SU_save_bitmex('1h')
                QA_SU_save_bitmex('1d')
            elif len(arg) == 1 and arg[0] == "huobi":
                pass
            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')
            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:
                        '''
                        save stock_day  :对应输入命令 save stock_day 
                        save stock_xdxr :对应输入命令 save stock_xdxr 
                        save stock_min  :对应输入命令 save stock_min 
                        save index_day  :对应输入命令 save index_day 
                        save index_min  :对应输入命令 save index_min 
                        save etf_day    :对应输入命令 save etf_day 
                        save etf_min    :对应输入命令 save etf_min 
                        save stock_list :对应输入命令 save stock_list
                        save stock_block:对应输入命令 save stock_block
                        save stock_info :对应输入命令 save stock_info
                        save index_list :对应输入命令 save index_list
                        save future_list :对应输入命令 save future_list
                        save future_day  : 对应输入命令  save future_day
                        save future_min  : 对应输入命令  save future_min
                        save future_day_all : 对应输入命令 save future_day_all
                        save future_min_all : 对应输入命令 save future_min_all
                        save option_day :对应输入命令 save option day
                        save option_min :对应输入命令 save option_min
                        save option_commodity_day :对应输入命令 save commodity_option_day
                        save option_commodity_min :对应输入命令 save commodity_option_min
                        save option_contract_list :对应输入命令 save option_contract_list
                        '''
                        try:
                            eval("QA_SU_save_%s('tdx')" % (i))
                        except:
                            print("❌命令格式不正确!")
                            self.print_save_usage()
Example #4
0
    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': '******'})
                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')
            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_1day()
                QA_SU_save_binance_1min()
            elif len(arg) == 2 and arg[0] == "binance":
                frequency = arg[1]
                QA_SU_save_binance(frequency)
            elif len(arg) == 1 and arg[0] == "huobi":
                pass
            elif len(arg) == 1 and arg[0] == "financialfiles":
                QA_SU_save_financialfiles()
            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:
                        '''
                        save stock_day  : save stock_day 
                        save stock_xdxr : save stock_xdxr 
                        save stock_min  : save stock_min 
                        save index_day  : save index_day 
                        save index_min  : save index_min 
                        save etf_day    : save etf_day 
                        save etf_min    : save etf_min 
                        save stock_list : save stock_list
                        save stock_block: save stock_block
                        save stock_info : save stock_info
                        '''
                        try:
                            eval("QA_SU_save_%s('tdx')" % (i))
                        except:
                            print("❌命令格式不正确!")
                            self.print_save_usage()
Example #5
0
     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()
     QA_SU_save_binance_1day()
     QA_SU_save_binance_1hour()
     QA_SU_save_binance_1min()
     done = True
 elif (cmdline_args.sub != False) and \
     (cmdline_args.sub == 'tencent_1min'):
     # 收线,收线
     sub_1min_from_tencent_lru()
     done = True
 elif (cmdline_args.check != False):
     blockname = [
         'MSCI中国', 'MSCI成份', 'MSCI概念', '三网融合', '上证180', '上证380', '沪深300',
         '上证380', '深证300', '上证50', '上证电信', '电信等权', '上证100', '上证150',
         '沪深300', '中证100', '中证500', '全指消费', '中小板指', '创业板指', '综企指数',
         '1000可选', '国证食品', '深证可选', '深证消费', '深成消费', '中证酒', '中证白酒', '行业龙头',
         '白酒', '证券', '消费100', '消费电子', '消费金融', '富时A50', '银行', '中小银行', '证券',