Aan de slagGa gratis aan de slag

The MSR portfolio

The maximum Sharpe ratio, or MSR portfolio, which lies at the apex of the efficient frontier, can be constructed by looking for the portfolio with the highest Sharpe ratio.

Unfortunately, the MSR portfolio is often quite erratic. Even though the portfolio had a high historical Sharpe ratio, it doesn't guarantee that the portfolio will have a good Sharpe ratio moving forward.

Deze oefening maakt deel uit van de cursus

Introduction to Portfolio Risk Management in Python

Cursus bekijken

Oefeninstructies

  • Sort RandomPortfolios with the highest Sharpe value, ranking in descending order.
  • Multiply MSR_weights_array across the rows of StockReturns to get weighted stock returns.
  • Finally, review the plot of cumulative returns over time.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Sort the portfolios by Sharpe ratio
sorted_portfolios = RandomPortfolios.____(by=['Sharpe'], ascending=____)

# Extract the corresponding weights
MSR_weights = sorted_portfolios.iloc[0, 0:numstocks]

# Cast the MSR weights as a numpy array
MSR_weights_array = np.array(MSR_weights)

# Calculate the MSR portfolio returns
StockReturns['Portfolio_MSR'] = StockReturns.iloc[:, 0:numstocks].mul(____, axis=1).sum(axis=1)

# Plot the cumulative returns
cumulative_returns_plot(['Portfolio_EW', 'Portfolio_MCap', 'Portfolio_MSR'])
Code bewerken en uitvoeren