def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_KCB_HASPRICELIMIT_GPMM_SHSJ_WDZC_142')
     clear_data_and_restart_all()
     Api.trade.Logout()
     Api.trade.Login()
     pass
예제 #2
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_PGJK_SHKCB_024')
     clear_data_and_restart_all()
     Api.trade.Logout()
     Api.trade.Login()
     pass
예제 #3
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset(self.py_name)
     sql_transfer.update_cur_fee_rate(2, self.py_name)
     clear_data_and_restart_sz()
     Api.trade.Logout()
     Api.trade.Login()
    def test_YW_KCB_HASPRICELIMIT_GPMM_SHSJ_WDZC_142(self):
        title = '分笔成交-累积成交金额 >= 手续费 且手续费小于最小值'
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、部成、全成、部撤已报、部撤、已报待撤、已撤、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动

        case_goal = {
            '期望状态': '全成',
            'errorID': 0,
            'errorMSG': queryOrderErrorMsg(0),
            '是否生成报单': '是',
            '是否是撤废': '否',
            # '是否是新股申购': '',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
            
            
        }
        logger.warning(title)
        # 定义委托参数信息------------------------------------------
        # 参数:证券代码、市场、证券类型、证券状态、交易状态、买卖方向(B买S卖)、期望状态、Api
        stkparm = QueryStkPriceQty('688011', '1', '4', '2', '0', 'S', case_goal['期望状态'], Api)
        # 如果下单参数获取失败,则用例失败
        if stkparm['返回结果'] is False:
            rs = {
                '用例测试结果': stkparm['返回结果'],
                '测试错误原因': '获取下单参数失败,' + stkparm['错误原因'],
            }
            print(stkparm['错误原因'])
            self.assertEqual(rs['用例测试结果'], True)
        else:
            wt_reqs = {
                'business_type': Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_CASH'],
                'order_client_id':5,
                'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
                'ticker': stkparm['证券代码'],
                'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_SELL'],
                'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_CANCEL'],
                'price': stkparm['涨停价'],
                'quantity': 300,
                'position_effect':Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
            }
            ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])
            CaseParmInsertMysql(case_goal, wt_reqs)
            rs = serviceTest(Api, case_goal, wt_reqs)
            logger.warning('执行结果为' + str(rs['用例测试结果']) + ','
                           + str(rs['用例错误源']) + ',' + str(rs['用例错误原因']))
            ## 还原可用资金
            sql_transfer = SqlData_Transfer()
            sql_transfer.transfer_fund_asset('YW_KCB_BAK_000')
            oms_restart()
            
            self.assertEqual(rs['用例测试结果'], True) # 203
예제 #5
0
    def test_YW_PGJK_SHKCB_026(self):
        title = '上海配股缴款--验资:资金=买金额-0.01'
        # 定义当前测试用例的期待值
        # 期望状态:初始、未成交、部成、全成、部撤已报、部撤、已报待撤、已撤、废单、撤废、内部撤单
        # xtp_ID和cancel_xtpID默认为0,不需要变动

        case_goal = {
            '期望状态': '废单',
            'errorID': 11010120,
            'errorMSG': queryOrderErrorMsg(11010120),
            '是否生成报单': '是',
            '是否是撤废': '否',
            '是否是新股申购': '否',
            'xtp_ID': 0,
            'cancel_xtpID': 0,
            
            
        }
        case_goal.pop("是否是新股申购")
        logger.warning(title)
        # 定义委托参数信息------------------------------------------
        # 参数:证券代码、市场、证券类型、证券状态、交易状态、买卖方向(B买S卖)、期望状态、Api
        ticker = '785026'
        # '1', '0', '2', '0', 'B'
        # 如果下单参数获取失败,则用例失败

        wt_reqs = {
            'business_type': Api.const.XTP_BUSINESS_TYPE['XTP_BUSINESS_TYPE_ALLOTMENT'],
            'order_client_id':2,
            'market': Api.const.XTP_MARKET_TYPE['XTP_MKT_SH_A'],
            'ticker': ticker,
            'side': Api.const.XTP_SIDE_TYPE['XTP_SIDE_BUY'],
            'price_type': Api.const.XTP_PRICE_TYPE['XTP_PRICE_BEST5_OR_LIMIT'],
            # 'price': 1,
            'quantity': 300,
            'position_effect':Api.const.XTP_POSITION_EFFECT_TYPE['XTP_POSITION_EFFECT_INIT']
        }
        ParmIni(Api, case_goal['期望状态'], wt_reqs['price_type'])

        rs = serviceTest(Api, case_goal, wt_reqs)
        logger.warning('执行结果为' + str(rs['用例测试结果']) + ','
                       + str(rs['用例错误源']) + ',' + str(rs['用例错误原因']))
                       
        ## 还原可用资金
        sql_transfer = SqlData_Transfer()
        sql_transfer.transfer_fund_asset('YW_KCB_BAK_000')
        oms_restart()
        
        self.assertEqual(rs['用例测试结果'], True) # 209
예제 #6
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_FXJSMM_SHXJ_030')
     clear_data_and_restart_sh()
     Api.trade.Logout()
     Api.trade.Login()
예제 #7
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_ETFMM_SHSJ_137_K')
     clear_data_and_restart_sh()
     Api.trade.Logout()
     Api.trade.Login()
예제 #8
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_KZZMM_SZXJ_080')
     clear_data_and_restart_sz()
     Api.trade.Logout()
     Api.trade.Login()
예제 #9
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_FJJJ_SZSS_027')
     clear_data_and_restart_sz()
     Api.trade.Logout()
     Api.trade.Login()
예제 #10
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_GEM_REGISTERMM_SZSJ_258')
     clear_data_and_restart_sz()
     Api.trade.Logout()
     Api.trade.Login()
예제 #11
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_KCB_BAK_000')
     clear_data_and_restart_all()
     Api.trade.Logout()
     Api.trade.Login()
예제 #12
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_KCB_KCBMM_SHSJ_BFZY_059')
     clear_data_and_restart_sh()
     Api.trade.Logout()
     Api.trade.Login()
예제 #13
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('yzyq_001')
     clear_data_and_restart_sh()
     Api.trade.Logout()
     Api.trade.Login()
예제 #14
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_PGJK_SHPG_023')
     clear_data_and_restart_sh()
     Api.trade.Logout()
     Api.trade.Login()
예제 #15
0
 def setUp(self):
     sql_transfer = SqlData_Transfer()
     sql_transfer.transfer_fund_asset('YW_FJJJ_SZCFHB_020')
     oms_restart()
     Api.trade.Logout()
     Api.trade.Login()