(self, max_weight=1.)
return w.value
Compute maximum return portfolio.
Compute maximum return portfolio.
Compute maximum return portfolio .
def maxret(self, max_weight=1.):
        """Compute maximum return portfolio."""
        w = cp.Variable(self.n_assets)
        ret = self.mean @ w
        prob = cp.Problem(cp.Maximize(ret),
                          [cp.sum(w) == 1,
                           w <= max_weight,
                           w >= 0])

        prob.solve()

        return w.value
def maxret ( self , max_weight = 1. ) : w = cp . Variable ( self . n_assets ) ret = self . mean @ w prob = cp . Problem ( cp . Maximize ( ret ) , [ cp . sum ( w ) == 1 , w <= max_weight , w >= 0 ] ) prob . solve ( ) return w . value