A portfolio weight is an asset’s share of a portfolio. Represent weights as a vector w; a fully allocated portfolio satisfies 1ᵀw = 1. Weights turn expected returns and a covariance matrix into portfolio expected return, μᵀw, and volatility, √(wᵀΣw). section 2.7 section 12.1.1 section 2.3
Three-stock allocation
For FE, WMT, and AAPL, weights specify how the portfolio is divided among the three holdings. Randomly generated values can be normalized by their sum, producing weights that total 1; negative weights represent short positions. Computing return and volatility for many such allocations makes the attainable risk–reward pattern visible. section 2.1 section 2.3
Weights are decision variables in portfolio construction. Minimum-variance optimization selects weights that minimize variance for a target expected return while requiring their sum to equal 1. Constraints can substantially change optimized allocations, and allocation between risky assets and a risk-free asset reflects risk tolerance. section 2.7 section 10.3 section 2.9
Weights need not remain fixed. Starting from a 60/40 stock–bond allocation, higher stock returns can shift the stock weight toward 83% over 30 years and raise portfolio volatility, motivating periodic rebalancing toward a target portfolio. section 13.1.1
Listing 2.5 Generating random portfolio weights
def random_weights(n_assets):
k = np.random.randn(n_assets)
return k / sum(k)
print(random_weights(3))
This small function generates random asset weights and normalizes them to sum to 1. section 2.3
