Portfolio Optimization, Quantitative Finance, Python Programming, Convex Optimization, Data Science.
constraints obj = cp.Minimize(w.T @ cov_annualized @ w) const = [ cp.sum(w) == 1, w >= 0, w.T @ r_annualized- r_min >= 0 ] # solve it! prob = cp.Problem(obj, const) opt_v = prob.solve() risk_opt = (opt_v * 252) ** 0.5 w_opt = w.value print('optimal risk (%):', risk_opt) print('optimal proportion:',