Skip to content

Instantly share code, notes, and snippets.

@druce
Created December 20, 2020 22:07
Show Gist options
  • Select an option

  • Save druce/59191a3dbf58d5cb80b48bdccd28653b to your computer and use it in GitHub Desktop.

Select an option

Save druce/59191a3dbf58d5cb80b48bdccd28653b to your computer and use it in GitHub Desktop.
po4.py
# Solve max return portfolio (corner solution)
prob = cp.Problem(cp.Maximize(ret), # maximize return
[cp.sum(w) == 1,
w >= 0]
)
prob.solve()
wts = [float('%0.4f' % v) for v in w.value]
maxretvol = vol.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment