Hi all,
I'm the author of PyPortfolioOpt, a python portfolio optimisation package that uses cvxpy on the backend. Apart from the standard portfolio optimisation functionality, I also have a function that uses linear programming to find the optimal discrete allocation of stocks (integer list), given a set of portfolio weights (float list).
This was working fine until ECOS_BB was removed in cvxpy 1.1. I pinned my cvxpy dependency to 1.0.38, but this is clearly not a sustainable solution as my users are requesting cvxpy 1.1 support. I was wondering if you had any advice on how I should move forward – I am reluctant to increase PyPortfolioOpt's dependency footprint by requiring the separate installation of other solvers, but any thoughts are appreciated.
For context, the linear program looks like this – by all means if you see any improvements here, let me know:
p = self.latest_prices.values # latest prices
n = len(p)
w = np.fromiter([i[1] for i in self.weights], dtype=float)
# Integer allocation
x = cp.Variable(n, integer=True)
# Remaining dollars
r = self.total_portfolio_value - p.T * x
# Objective function is remaining dollars + sum of absolute deviations from ideality.
objective = r + cp.norm(w * self.total_portfolio_value - cp.multiply(x, p), 1)
constraints = [r + p.T * x == self.total_portfolio_value, x >= 0, r >= 0]
opt = cp.Problem(cp.Minimize(objective), constraints)
opt.solve()