Equal weighted portfolios
When comparing different portfolios, you often want to consider performance versus a naive equally-weighted portfolio. If the portfolio doesn't outperform a simple equally weighted portfolio, you might want to consider another strategy, or simply opt for the naive approach if all else fails. You can expect equally-weighted portfolios to tend to outperform the market when the largest companies are doing poorly. This is because even tiny companies would have the same weight in your equally-weighted portfolio as Apple or Amazon, for example.
To make it easier for you to visualize the cumulative returns of portfolios, we defined the function cumulative_returns_plot()
in your workspace.
This is a part of the course
“Introduction to Portfolio Risk Management in Python”
Exercise instructions
- Set
numstocks
equal to9
, which is the number of stocks in your portfolio. - Use
np.repeat()
to setportfolio_weights_ew
equal to an array with an equal weights for each of the 9 stocks. - Use the
.iloc
accessor to select all rows and the first 9 columns when calculating the portfolio return. - Finally, review the plot of cumulative returns over time.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# How many stocks are in your portfolio?
numstocks = ____
# Create an array of equal weights across all assets
portfolio_weights_ew = ____
# Calculate the equally-weighted portfolio returns
StockReturns['Portfolio_EW'] = StockReturns.iloc[____, ____].mul(portfolio_weights_ew, axis=1).sum(axis=1)
cumulative_returns_plot(['Portfolio', 'Portfolio_EW'])