Esempio n. 1
0
    def test_YW_CETFSS_SHSH_021(self):
        # -----------ETF赎回-------------
        title = ('上海ETF赎回--允许现金替代:T日ETF拥股量1unit→T日赎回ETF')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530330',  # etf代码
            'etf_unit_buy': 1.0,  # etf买入单位数
            'etf_unit': 1.0,  # etf赎回单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------T日买入etf-------------
        cetf_add(Api, Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                 unit_info['ticker'], unit_info['etf_unit_buy'])

        # -----------查询ETF赎回前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf赎回数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 查询etf成分股代码和数量
        etf_components = query_cetf_component_share(unit_info['ticker'])
        rs3 = {}
        for stk_code in etf_components:
            # 赎回用例1-25会有上海和深圳的成分股各一支,深圳成分股为'008000',只卖上海的
            if stk_code != '008000':
                components_share = etf_components[stk_code]
                quantity = (int(unit_info['component_unit_sell'])
                            if unit_info['component_unit_sell'] >= 100 else
                            int(components_share *
                                unit_info['component_unit_sell']))
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 2
0
    def test_YW_CETFSS_SHSG_004(self):
        # -----------ETF申购-------------
        title = '上海ETF申购--禁止现金替代:T-1日成分股可以申购2unitETF→T日申购ETF'
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '550140',  # etf代码
            'etf_unit': 1.0,  # etf申购单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------查询ETF申购前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申购数量
        quantity = int(unit_info['etf_unit'] * unit_number)
        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
            2,
            'market':
            Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
            unit_info['ticker'],
            'side':
            Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type':
            Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
            quantity,
            'position_effect':
            Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity,
                'position_effect':
                Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 查询etf成分股代码和数量
        etf_components = query_cetf_component_share(unit_info['ticker'])
        # 如果卖出单位大于100,表示卖出数量;小于100,表示卖出份数
        rs3 = {}
        for stk_code in etf_components:
            # 申购用例1-43会有上海和深圳的成分股各一支,深圳成分股为'008000',只卖上海的
            if stk_code != '008000':
                components_share = etf_components[stk_code]
                quantity = (int(unit_info['component_unit_sell'])
                            if unit_info['component_unit_sell'] >= 100 else
                            int(components_share *
                                unit_info['component_unit_sell']))
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity,
                    'position_effect':
                    Api.const.
                    XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 3
0
    def test_YW_CETFSS_SHSG_073(self):
        # -----------ETF申购-------------
        title = (
            '设置ETF申购费用上海ETF申购--深市必须全部现金替代:T日有成分股可申购1unitETF&可用资金足额→T日申购ETF')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '550910',  # etf代码
            'component_unit_buy': 1.0,  # 成分股买入单位数
            'etf_unit': 1.0,  # etf申购单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------T日买入成分股-------------
        cetf_basket_add(Api, Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                        unit_info['ticker'], unit_info['component_unit_buy'])

        # -----------查询ETF申购前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申购数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 查询etf成分股代码和数量
        etf_components = query_cetf_component_share(unit_info['ticker'])
        rs3 = {}
        for stk_code in etf_components:
            # 申购用例1-43会有上海和深圳的成分股各一支,深圳成分股为'008000',只卖上海的
            if stk_code != '008000':
                components_share = etf_components[stk_code]
                components_total = (int(unit_info['component_unit_sell'])
                                    if unit_info['component_unit_sell'] >= 100
                                    else int(components_share *
                                             unit_info['component_unit_sell']))
                # 如果买入成分股包含半份,买入时数量取整了,卖出成分股是也要取整
                if str(unit_info['component_unit_buy'])[-1] == '5':
                    quantity = get_valid_amount(components_total)
                else:
                    quantity = components_total
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SZ_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 4
0
    def test_YW_CETFSS_SHSH_065(self):
        # -----------ETF赎回-------------
        title = ('T-1日申购ETF-T日赎回ETF-用T日赎回得到的成分股申购ETF-卖T日赎回的ETF成分股')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530670',  # etf代码
            'etf_unit': 1.0,  # etf申赎单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # 查询ETF赎回前成分股持仓
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申赎数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
            2,
            'market':
            Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
            unit_info['ticker'],
            'side':
            Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type':
            Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
            quantity,
            'position_effect':
            Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(
            Api,
            case_goal,
            wt_reqs,
            component_stk_info,
        )
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # -----------ETF申购-------------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 查询ETF申购前成分股持仓
        component_stk_info2 = cetf_get_all_component_stk(
            Api, unit_info['ticker'])
        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
            2,
            'market':
            Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
            unit_info['ticker'],
            'side':
            Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type':
            Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
            quantity,
            'position_effect':
            Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs2 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info2)
        etf_creation_log(case_goal, rs2)
        self.assertEqual(rs2['用例测试结果'], True)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 查询etf成分股代码、数量、现金替代标志等
        etf_components = query_cetf_components_info(unit_info['ticker'], 1)
        # 如果卖出单位大于100,表示卖出数量;小于100,表示卖出份数
        rs3 = {}
        for component_info in etf_components:
            substitute_flag = component_info[1]
            if substitute_flag in (0, 1):
                stk_code = component_info[0]
                components_share = component_info[2]
                quantity = (int(unit_info['component_unit_sell'])
                            if unit_info['component_unit_sell'] >= 100 else
                            int(components_share *
                                unit_info['component_unit_sell']))
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity,
                    'position_effect':
                    Api.const.
                    XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 5
0
    def test_YW_CETFSS_SHSH_086(self):
        # -----------ETF赎回-------------
        title = ('上海:折价套利(当ETF二级市场实际交易价格小于ETF份额参考净值大时,产生折价套利)')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530820',  # etf代码
            'etf_unit_buy': 1.0,  # etf买入单位数
            'etf_unit': 1.0,  # etf申赎单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------T日买入etf-------------
        cetf_add(Api, Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                 unit_info['ticker'], unit_info['etf_unit_buy'])
        time.sleep(1)

        # 查询ETF赎回前成分股持仓
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申赎数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(
            Api,
            case_goal,
            wt_reqs,
            component_stk_info,
        )
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 查询etf成分股代码、数量、现金替代标志等
        etf_components = query_cetf_components_info(unit_info['ticker'], 1)
        # 如果卖出单位大于100,表示卖出数量;小于100,表示卖出份数
        rs3 = {}
        for component_info in etf_components:
            substitute_flag = component_info[1]
            if substitute_flag in (0, 1):
                stk_code = component_info[0]
                components_share = component_info[2]
                quantity = (int(unit_info['component_unit_sell'])
                            if unit_info['component_unit_sell'] >= 100 else
                            int(components_share *
                                unit_info['component_unit_sell']))
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 6
0
    def test_YW_CETFSS_SHSG_012(self):
        # -----------ETF申购-------------
        title = ('上海ETF申购--必须全部现金替代:' +
                 'T-1日无成分股&可用资金恰好→T日申购ETF')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '550230',  # etf代码
            'etf_unit': 1,  # etf申购单位数
            'component_unit_sell': 1  # 成分股卖出单位数
        }

        # -----------查询ETF申购前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(Api,unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
                2,
            'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
                unit_info['ticker'],
            'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
                int(unit_info['etf_unit'] * unit_number)
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs,component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        quantity = int(unit_info['etf_unit'] * unit_number) # 二级市场卖出etf数量
        quantity_list = split_etf_quantity(quantity)
        limitup_px = getUpPrice(unit_info['ticker'])  # 查询涨停价
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                    2,
                'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                    unit_info['ticker'],
                'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                    limitup_px,
                'quantity':
                    etf_quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)

        # ------------二级市场卖出成份股-----------
        # 查询etf成分股代码和数量
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        etf_components = query_cetf_component_share(unit_info['ticker'])
        rs3 = {}
        for stk_code in etf_components:
            components_share = etf_components[stk_code]
            quantity = int(components_share *
                                   unit_info['component_unit_sell'])
            limitup_px = getUpPrice(stk_code)
            wt_reqs = {
                'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                    2,
                'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                    stk_code,
                'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                    limitup_px,
                'quantity':
                    quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs3 = serviceTest(Api, case_goal, wt_reqs)
            if rs3['用例测试结果'] is False:
                etf_components_sell_log(case_goal, rs3)
                self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 7
0
    def test_YW_CETFSS_SHSH_002(self):
        # -----------ETF赎回-------------
        title = ('上海ETF赎回--OMS初始化—可选权限—Fundinfo表,资金账号无跨市场ETF申赎权限')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        updateAllFundRightHasNoP()
        clear_data_and_restart_all()
        Api.trade.Logout()
        Api.trade.Login()
        case_goal = {
            '期望状态': '废单',
            'errorID': 11000555,
            'errorMSG': queryOrderErrorMsg(11000555),
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530150',  # etf代码
            'etf_unit_buy': 1.0,  # etf买入单位数
            'etf_unit': 1.0,  # etf赎回单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------T日买入etf-------------
        cetf_add(Api, Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                 unit_info['ticker'], unit_info['etf_unit_buy'])

        # -----------查询ETF赎回前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf赎回数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
            2,
            'market':
            Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
            unit_info['ticker'],
            'side':
            Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type':
            Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
            quantity,
            'position_effect':
            Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity,
                'position_effect':
                Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)
Esempio n. 8
0
    def test_YW_CETFSS_SHSG_110(self):
        # -----------ETF申购-------------
        title = ('上海:当日申购的基金份额,当日可以卖出并检查持仓')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '540110',  # etf代码
            'component_unit_buy': 1.0,  # 成分股买入单位数
            'etf_unit': 1.0,  # etf申购单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 1.0  # 成分股卖出单位数
        }

        # -----------T日买入成分股-------------
        cetf_basket_add(Api, Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                        unit_info['ticker'], unit_info['component_unit_buy'])

        # -----------查询ETF申购前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申购数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id':
            2,
            'market':
            Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker':
            unit_info['ticker'],
            'side':
            Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type':
            Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity':
            quantity,
            'position_effect':
            Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity,
                'position_effect':
                Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)
Esempio n. 9
0
    def test_YW_CETFSS_SHSH_044(self):
        # -----------ETF赎回-------------
        title = '赎回真实的ETF-可赎回的证券数足量,资金足额,预估现金差额>0'
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530580',  # etf代码
            'etf_unit': 10.0,  # etf赎回单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
            'component_unit_sell': 10.0  # 成分股卖出单位数
        }

        # -----------查询ETF赎回前成分股持仓-------------
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf赎回数量
        quantity = int(unit_info['etf_unit'] * unit_number)
        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info)
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs2 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs2 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs2['用例测试结果'] is False:
                etf_sell_log(case_goal, rs2)
                self.assertEqual(rs2['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs2)

        # ------------二级市场卖出成份股-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 查询etf成分股代码、数量、现金替代标志等
        etf_components = query_cetf_components_info(unit_info['ticker'], 1)
        # 如果卖出单位大于100,表示卖出数量;小于100,表示卖出份数
        rs3 = {}
        for component_info in etf_components:
            substitute_flag = component_info[1]
            if substitute_flag in (0, 1):
                stk_code = component_info[0]
                components_share = component_info[2]
                quantity = (int(unit_info['component_unit_sell'])
                            if unit_info['component_unit_sell'] >= 100 else
                            int(components_share *
                                unit_info['component_unit_sell']))
                limitup_px = getUpPrice(stk_code)
                wt_reqs = {
                    'business_type':
                    Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                    'order_client_id':
                    2,
                    'market':
                    Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                    'ticker':
                    stk_code,
                    'side':
                    Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                    'price_type':
                    Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                    'price':
                    limitup_px,
                    'quantity':
                    quantity
                }
                ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
                rs3 = serviceTest(Api, case_goal, wt_reqs)
                if rs3['用例测试结果'] is False:
                    etf_components_sell_log(case_goal, rs3)
                    self.assertEqual(rs3['用例测试结果'], True)
        etf_components_sell_log(case_goal, rs3)
        self.assertEqual(rs3['用例测试结果'], True)
Esempio n. 10
0
    def test_YW_CETFSS_SHSH_067(self):
        # -----------ETF申购-------------
        title = ('T日申购ETF-T日赎回当天申购的ETF-T日卖出T日的ETF')
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、全成、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动
        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': '',
            '是否生成报单': '是',
            '是否是撤废': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
        }
        logger.warning(title)
        unit_info = {
            'ticker': '530690',  # etf代码
            'etf_unit': 1.0,  # etf申赎单位数
            'etf_unit_sell': 1.0,  # etf卖出单位数
        }

        # 查询ETF申购前成分股持仓
        component_stk_info = cetf_get_all_component_stk(
            Api, unit_info['ticker'])

        # 查询etf最小申赎数量
        unit_number = query_creation_redem_unit(unit_info['ticker'])
        # etf申赎数量
        quantity = int(unit_info['etf_unit'] * unit_number)

        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_PURCHASE'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs1 = cetf_service_test(
            Api,
            case_goal,
            wt_reqs,
            component_stk_info,
        )
        etf_creation_log(case_goal, rs1)
        self.assertEqual(rs1['用例测试结果'], True)

        # -----------ETF赎回-------------
        case_goal['期望状态'] = '废单'
        case_goal['errorID'] = 11010121
        case_goal['errorMSG'] = queryOrderErrorMsg(11010121)
        # 查询ETF赎回前成分股持仓
        component_stk_info2 = cetf_get_all_component_stk(
            Api, unit_info['ticker'])
        # 定义委托参数信息------------------------------------------
        wt_reqs = {
            'business_type':
            Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ETF'],
            'order_client_id': 2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': unit_info['ticker'],
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_REDEMPTION'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_LIMIT'],
            'quantity': quantity
        }
        g_func.cetf_parm_init(case_goal['期望状态'])
        rs2 = cetf_service_test(Api, case_goal, wt_reqs, component_stk_info2)
        etf_creation_log(case_goal, rs2)
        self.assertEqual(rs2['用例测试结果'], True)

        # --------二级市场,卖出etf-----------
        case_goal['期望状态'] = '全成'
        case_goal['errorID'] = 0
        case_goal['errorMSG'] = ''
        # 二级市场卖出的etf数量
        quantity = int(unit_info['etf_unit_sell'] * unit_number)
        quantity_list = split_etf_quantity(quantity)
        # 查询涨停价
        limitup_px = getUpPrice(unit_info['ticker'])
        rs3 = {}
        for etf_quantity in quantity_list:
            wt_reqs_etf = {
                'business_type':
                Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':
                2,
                'market':
                Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker':
                unit_info['ticker'],
                'side':
                Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type':
                Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price':
                limitup_px,
                'quantity':
                etf_quantity
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            rs3 = serviceTest(Api, case_goal, wt_reqs_etf)
            if rs3['用例测试结果'] is False:
                etf_sell_log(case_goal, rs3)
                self.assertEqual(rs3['用例测试结果'], True)
                return
        etf_sell_log(case_goal, rs3)