Commit 9dac0aeb authored by Dr.李's avatar Dr.李

fixed bug for new cvxpy version

parent c730cd46
...@@ -91,7 +91,6 @@ def linear_builder(er: np.ndarray, ...@@ -91,7 +91,6 @@ def linear_builder(er: np.ndarray,
elif method.lower() == 'ecos': elif method.lower() == 'ecos':
from cvxpy import Problem from cvxpy import Problem
from cvxpy import Variable from cvxpy import Variable
from cvxpy import multiply
from cvxpy import norm1 from cvxpy import norm1
from cvxpy import Minimize from cvxpy import Minimize
......
...@@ -74,7 +74,7 @@ def mean_variance_builder(er: np.ndarray, ...@@ -74,7 +74,7 @@ def mean_variance_builder(er: np.ndarray,
prob.solve(solver='ECOS', feastol=1e-9, abstol=1e-9, reltol=1e-9) prob.solve(solver='ECOS', feastol=1e-9, abstol=1e-9, reltol=1e-9)
if prob.status == 'optimal' or prob.status == 'optimal_inaccurate': if prob.status == 'optimal' or prob.status == 'optimal_inaccurate':
return 'optimal', prob.value, np.array(w.value) + bm return 'optimal', prob.value, np.array(w.value).flatten() + bm
else: else:
raise PortfolioBuilderException(prob.status) raise PortfolioBuilderException(prob.status)
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment