Get the max Sharpe ratio portfolio

def max_sharpe(self):
        """Get the max Sharpe ratio portfolio"""
        if not self.w:
            self.solve()
        # 1) Compute the local max SR portfolio between any two neighbor turning points
        w_sr, sr = [], []
        for i in range(len(self.w) - 1):
            w0 = np.copy(self.w[i])
            w1 = np.copy(self.w[i + 1])
            kargs = {"minimum": False, "args": (w0, w1)}
            a, b = self.golden_section(self.eval_sr, 0, 1, **kargs)
            w_sr.append(a * w0 + (1 - a) * w1)
            sr.append(b)
        # return max(sr), w_sr[sr.index(max(sr))]
        self.weights = w_sr[sr.index(max(sr))].reshape((self.n_assets,))
        return dict(zip(self.tickers, self.weights))