
Diversification
This handles the math behind portfolio diversification, from basic two-asset variance formulas through efficient frontier construction and risk contribution analysis. You'll reach for it when building portfolios, computing correlations, or explaining why holding 50 tech stocks isn't actually diversified. It covers minimum variance portfolios, diversification ratios, and factor-based approaches. The most useful bit is probably the risk contribution decomposition, which shows exactly which positions drive your portfolio volatility. One thing to know: it's grounded in the reality that correlations spike during crises, so the examples include stress-testing correlation matrices rather than pretending diversification always works when you need it.
- skills.sh installs
- 769
- GitHub stars
- 224
- last updated
- Aug 21, 2026
Install
$ npx -y skills add joellewis/finance_skills --skill diversification --agent claude-codeInstalls into .claude/skills of the current project.
Files
Diversification
Core Concepts
Portfolio Variance (2 Assets)
For a portfolio of two assets with weights w_1 and w_2, volatilities sigma_1 and sigma_2, and correlation rho_12:
sigma^2_p = w_1^2 * sigma_1^2 + w_2^2 * sigma_2^2 + 2 * w_1 * w_2 * sigma_1 * sigma_2 * rho_12
Diversification benefit arises whenever rho_12 < 1, because the portfolio volatility will be less than the weighted average of individual volatilities.
Portfolio Variance (n Assets)
In matrix notation for n assets with weight vector w and covariance matrix Sigma:
sigma^2_p = w' * Sigma * w
This generalizes to any number of assets and captures all pairwise correlations.
Diversification Benefit
Portfolio volatility is strictly less than the weighted average of individual volatilities whenever any pairwise correlation is below 1:
sigma_p < Sigma(w_i * sigma_i) when rho_ij < 1 for some i,j
The lower the average correlation, the greater the diversification benefit.
Sponsors
Details
- Repository
- github.com/joellewis/finance_skills
- Categories
- DevOps & CI/CD, Finance & Trading
- First seen
- Jun 3, 2026
More from joellewis/finance_skills
All 84- Currencies And Fx765
- Historical Risk761
- Liquidity Management756
- Bet Sizing755
- Time Value Of Money754
- Account Transfers753
- Volatility Modeling753
- Financial Planning Workflow751
- Emergency Fund748
- Performance Metrics746
- Data Quality745
- Return Calculations745
- Lending741
- Savings Goals741
- Trade Execution739
- Fund Vehicles737
- Forward Risk733
- Privacy Data Security731
- Performance Reporting729
- Equities727
- Tax Efficiency724
- Anti Money Laundering723
- Financial Planning Integration723
- Advertising Compliance722