What are you trying to do?
I was attempting to obtain asset allocation weights based on 7-day asset values. Beginning in 2018, and ending in 2021. It works properly until the day 2020-02-20 arrives. From what I observed, it fails when all assets give negative return? If so, are there any alterative ways for avoiding this error? When it iterates over the data set shown below, it throws the following error:
mu = expected_returns.mean_historical_return(stockData)
cov = risk_models.CovarianceShrinkage(stockData).ledoit_wolf()
ef = EfficientFrontier(mu, cov)
weights = ef.max_sharpe() #<------- error occurs upon execution of this line
in BaseConvexOptimizer._solve_cvxpy_opt_problem(self)
297 raise exceptions.OptimizationError from e
299 if self._opt.status not in {"optimal", "optimal_inaccurate"}:
--> 300 raise exceptions.OptimizationError(
301 "Solver status: {}".format(self._opt.status)
302 )
303 self.weights = self._w.value.round(16) + 0.0 # +0.0 removes signed zero
304 return self._make_output_weights()
OptimizationError: ('Please check your objectives/constraints or use a different solver.', 'Solver status: infeasible')
What data are you using?
Data of that iteration
Price data:
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
What are you trying to do? I was attempting to obtain asset allocation weights based on 7-day asset values. Beginning in 2018, and ending in 2021. It works properly until the day 2020-02-20 arrives. From what I observed, it fails when all assets give negative return? If so, are there any alterative ways for avoiding this error? When it iterates over the data set shown below, it throws the following error:
Error messages:
What data are you using?
Data of that iteration Price data: <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
Date | HQL | GHY | BHK | MKTX -- | -- | -- | -- | -- 2020-02-20 00:00:00 | 17.89 | 15.33 | 15.49 | 344.6 2020-02-21 00:00:00 | 17.86 | 15.22 | 15.53 | 340.09 2020-02-24 00:00:00 | 17.47 | 14.99 | 15.69 | 341.91 2020-02-25 00:00:00 | 16.96 | 14.76 | 15.38 | 331.2 2020-02-26 00:00:00 | 17.16 | 14.91 | 15.13 | 338.28 2020-02-27 00:00:00 | 16.2 | 14.49 | 15.13 | 333.34 2020-02-28 00:00:00 | 15.88 | 14.24 | 14.85 | 324.33