Hi, thanks for sharing your work. I am getting the following error and I cannot figure it out if you have any ideas. I already replaced ix by loc and min_ret = Parameters(nonneg=True):
Sorry, I'm not maintaining this project any more. I'm sure the various libraries and dependencies have changed their APIs since this code was last run (years ago).
Hi, thanks for sharing your work. I am getting the following error and I cannot figure it out if you have any ideas. I already replaced ix by loc and min_ret = Parameters(nonneg=True):
TypeError Traceback (most recent call last) ~/Documents/Python/markowitz-portfolio-optimization-original/main.py in () 52 while date_index_iter + 20 < end_index: 53 date = index[date_index_iter] ---> 54 portfolio_alloc = MarkowitzOpt(shift_returns_mean.loc[date], shift_returns_var.loc[date], covariance.loc[date], interest_rate, min_return) 55 distribution[date.strftime('%Y-%m-%d')] = portfolio_alloc 56
~/Documents/Python/markowitz-portfolio-optimization-original/markowitz.py in MarkowitzOpt(mean, variance, covariance, interest_rate, min_return) 31 ret = mu.T* w 32 risk = quad_form(w, Sigma) ---> 33 min_ret = Parameter(nonneg=True) 34 min_ret.value = min_return 35 prob = Problem(Minimize(risk), # Restricting to long-only portfolio
/opt/anaconda3/envs/financial-analysis/lib/python3.10/site-packages/cvxpy/expressions/constants/parameter.py in init(self, shape, name, value, id, kwargs) 59 self._value = None 60 self.delta = None ---> 61 #self.gradient = None 62 super(Parameter, self).init(shape, value, kwargs) 63 self._is_constant = True
TypeError: Leaf.init() got an unexpected keyword argument 'sign'