Get startedGet started for free

Market-cap weighted portfolios

Conversely, when large companies are doing well, market capitalization, or "market cap" weighted portfolios tend to outperform. This is because the largest weights are being assigned to the largest companies, or the companies with the largest market cap.

Below is a table of the market capitalizations of the companies in your portfolio just before January 2017:

Company Name Ticker Market Cap ($ Billions)
Apple AAPL 601.51
Microsoft MSFT 469.25
Exxon Mobil XOM 349.5
Johnson & Johnson JNJ 310.48
JP Morgan JPM 299.77
Amazon AMZN 356.94
General Electric GE 268.88
Facebook FB 331.57
AT&T T 246.09

This exercise is part of the course

Introduction to Portfolio Risk Management in Python

View Course

Exercise instructions

  • Finish defining the market_capitalizations array of market capitalizations in billions according to the table above.
  • Calculate mcap_weights array such that each element is the ratio of market cap of the company to the total market cap of all companies.
  • Use the .mul() method on the mcap_weights and returns to calculate the market capitalization weighted portfolio returns.
  • Finally, review the plot of cumulative returns over time.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create an array of market capitalizations (in billions)
market_capitalizations = np.array([601.51, 469.25, 349.5, 310.48, 299.77, 356.94, 268.88, 331.57, ____])

# Calculate the market cap weights
mcap_weights = ____

# Calculate the market cap weighted portfolio returns
StockReturns['Portfolio_MCap'] = StockReturns.iloc[:, 0:9].mul(____, axis=1).sum(axis=1)
cumulative_returns_plot(['Portfolio', 'Portfolio_EW', 'Portfolio_MCap'])
Edit and Run Code