Пример #1
0
 def test_main_entry_no_instance_test_constr_cls_instance(self):
     from QuantOPT.constraints.constraints import Constraints
     # constr_cls = create_constraints_holder(setting_yaml_path)
     result = RunOpt.run_opt_single(self.kwargs_data, [],
                                    self.method,
                                    constr_cls=Constraints)
     self.assertEqual(result.success, True)
Пример #2
0
 def test_main_entry_no_instance_test_constr_cls(self):
     constraint_param_list = []
     from QuantOPT.conf.conf import setting_yaml_path
     result = RunOpt.run_opt_single(self.kwargs_data,
                                    constraint_param_list,
                                    self.method,
                                    constr_cls=setting_yaml_path)
     self.assertEqual(result.success, True)
Пример #3
0
 def test_no_exists_constraints(self):
     kwargs_data = {'stockpool': stock_pool, 'sigma2': cov_price}
     constraint_param_list = [('not_exists', {'bound_value': 5}, 1, 'ineq')]
     from QuantOPT.conf.conf import setting_yaml_path
     with self.assertRaises(AttributeError):
         result = RunOpt.run_opt_single(kwargs_data,
                                        constraint_param_list,
                                        'MinVar',
                                        constr_cls=setting_yaml_path)
Пример #4
0
 def test_main_entry_no_instance(self):
     kwargs_data = {
         'stockpool': stock_pool,
         'sigma2': cov_price,
     }
     constraint_param_list = []
     result = RunOpt.run_opt_single(kwargs_data, constraint_param_list,
                                    self.method)
     self.assertEqual(result.success, True)
Пример #5
0
 def test_main_entry_no_instance_test_constr_cls(self):
     kwargs_data = {'stockpool': stock_pool, 'sigma2': cov_price}
     constraint_param_list = []
     from QuantOPT.conf.conf import setting_yaml_path
     result = RunOpt.run_opt_single(kwargs_data,
                                    constraint_param_list,
                                    self.method,
                                    constr_cls=setting_yaml_path)
     self.assertEqual(result.success, True)
Пример #6
0
 def test_no_exists_constraints_priority_wrong(self):
     kwargs_data = {'stockpool': stock_pool, 'sigma2': cov_price}
     constraint_param_list = [('general_count_lower_rc', {
         'bound_value': 5
     }, 'f', 'ineq')]
     from QuantOPT.conf.conf import setting_yaml_path
     with self.assertRaises(TypeError):
         result = RunOpt.run_opt_single(kwargs_data,
                                        constraint_param_list,
                                        'MinVar',
                                        constr_cls=setting_yaml_path)
Пример #7
0
 def test_main_entry_no_instance_test_constr_cls_instance(self):
     kwargs_data = {
         'stockpool': stock_pool,
         'sigma2': cov_price,
     }
     constraint_param_list = []
     from QuantOPT.constraints.constraints import Constraints
     # constr_cls = create_constraints_holder(setting_yaml_path)
     result = RunOpt.run_opt_single(kwargs_data,
                                    constraint_param_list,
                                    self.method,
                                    constr_cls=Constraints)
     self.assertEqual(result.success, True)
Пример #8
0
 def test_main_entry_no_instance_test_constr_cls_create_instance(self):
     kwargs_data = {
         'stockpool': stock_pool,
         'sigma2': cov_price,
         'lambda_r': 2,
         'portfolio_returns': return_matrix
     }
     constraint_param_list = []
     from QuantOPT.conf.conf import setting_yaml_path
     from QuantOPT.constraints.constraints import create_constraints_holder
     constr_cls = create_constraints_holder(setting_yaml_path)
     result = RunOpt.run_opt_single(kwargs_data,
                                    constraint_param_list,
                                    self.method,
                                    constr_cls=constr_cls)
     self.assertEqual(result.success, True)
Пример #9
0
 def test_no_exists_model(self):
     kwargs_data = {'stockpool': stock_pool, 'sigma2': cov_price}
     constraint_param_list = []
     with self.assertRaises(AttributeError):
         result = RunOpt.run_opt_single(kwargs_data, constraint_param_list,
                                        'test')
Пример #10
0
 def test_main_entry_no_instance(self):
     constraint_param_list = []
     result = RunOpt.run_opt_single(self.kwargs_data, constraint_param_list,
                                    self.method)
     self.assertEqual(result.success, True)