Portfolio Mathematics - Enhanced Study Guide
Learning Objective 1: Portfolio Returns Calculations
Core Concept: Portfolio Theory Foundations
Portfolio mathematics forms the cornerstone of modern portfolio theory, developed by Harry Markowitz. Building on the statistical measures of variance and correlation, the fundamental insight is that portfolio risk depends not only on individual asset risks but also on how assets move together (covariance). This allows investors to construct portfolios that offer superior risk-adjusted returns through diversification.
Key Principles:
- Portfolio return is the weighted average of individual asset returns
- Portfolio risk is NOT the weighted average of individual risks due to correlation effects
- Diversification reduces portfolio risk when assets are not perfectly correlated
- The efficient frontier represents optimal risk-return combinations
Formulas & Calculations
Portfolio Expected Return
Formula: E(Rp) = Σ(wi × E(Ri)) formula
Where:
- E(Rp) = Expected portfolio return
- wi = Weight of asset i in the portfolio
- E(Ri) = Expected return of asset i
HP 12C Steps for 2-Asset Portfolio:
- Clear calculator: [f][CLX]
- Enter weight 1: [w1][ENTER]
- Enter return 1: [R1][×]
- Store result: [STO][1]
- Enter weight 2: [w2][ENTER]
- Enter return 2: [R2][×]
- Add results: [RCL][1][+]
- Portfolio return displayed
Portfolio Variance (2-Asset)
Formula: σ²p = w₁²σ₁² + w₂²σ₂² + 2w₁w₂σ₁σ₂ρ₁₂ formula exam-focus
Where:
- σ²p = Portfolio variance
- w₁, w₂ = Weights of assets 1 and 2
- σ₁², σ₂² = Variances of assets 1 and 2
- ρ₁₂ = Correlation coefficient between assets 1 and 2
HP 12C Steps for Portfolio Variance:
- Calculate w₁²σ₁²: [w1][x²][σ1²][×][STO][1]
- Calculate w₂²σ₂²: [w2][x²][σ2²][×][STO][2]
- Calculate 2w₁w₂σ₁σ₂ρ₁₂: [2][w1][×][w2][×][σ1][×][σ2][×][ρ12][×][STO][3]
- Sum components: [RCL][1][RCL][2][+][RCL][3][+]
Portfolio Standard Deviation
Formula: σp = √σ²p
HP 12C Steps:
- After calculating variance: [√x]
Practical Examples
Example 1: Two-Asset Portfolio
Given:
- Asset A: E(RA) = 12%, σA = 20%, wA = 60%
- Asset B: E(RB) = 8%, σB = 15%, wB = 40%
- Correlation ρAB = 0.3
Solution:
-
Portfolio Return: E(Rp) = 0.6 × 12% + 0.4 × 8% = 10.4%
-
Portfolio Variance: σ²p = (0.6)²(0.20)² + (0.4)²(0.15)² + 2(0.6)(0.4)(0.20)(0.15)(0.3) σ²p = 0.0144 + 0.0036 + 0.00216 = 0.02016
-
Portfolio Standard Deviation: σp = √0.02016 = 14.2%
Example 2: Multi-Asset Portfolio
Given:
- Asset 1: E(R₁) = 15%, σ₁ = 25%, w₁ = 50%
- Asset 2: E(R₂) = 10%, σ₂ = 18%, w₂ = 30%
- Asset 3: E(R₃) = 6%, σ₃ = 8%, w₃ = 20%
- Correlations: ρ₁₂ = 0.4, ρ₁₃ = 0.2, ρ₂₃ = 0.1
Solution: E(Rp) = 0.5(15%) + 0.3(10%) + 0.2(6%) = 11.7%
For variance calculation with multiple assets: σ²p = Σwi²σi² + ΣΣ(i≠j)wiwjσiσjρij
DeFi Application: Liquidity Provider Positions
Uniswap V3 LP Position Analysis
When providing liquidity to a Uniswap V3 pool, your position acts like a portfolio of the two underlying tokens with dynamic weights based on price movements. The portfolio mathematics framework applies directly — the LP’s return is a weighted combination of the underlying token returns, adjusted for fee income and impermanent loss. defi-application
Example: ETH/USDC LP Position
- Range: 2,200
- Current ETH price: $2,000
- LP tokens represent: 60% ETH, 40% USDC
Calculating LP Position Returns:
- ETH component return: wETH × E(RETH)
- USDC component return: wUSDC × E(RUSDC)
- Fee income: Daily volume × Fee tier × Your pool share
- Impermanent loss adjustment: Based on price divergence
HP 12C LP Return Calculation:
1. [0.6][ENTER][15%][×][STO][1] // ETH component
2. [0.4][ENTER][0%][×][STO][2] // USDC component
3. [2%][STO][3] // Fee income (annualized)
4. [RCL][1][RCL][2][+][RCL][3][+] // Total LP return
Learning Objective 2: Covariance and Correlation with Joint Probability Functions
Core Concept: Joint Probability Distributions
Joint probability functions describe the likelihood of different combinations of returns occurring simultaneously. This approach provides a more sophisticated method for calculating covariance and correlation, especially useful in scenarios with discrete return outcomes.
Joint Probability Properties:
- ΣΣP(Ri,Rj) = 1 (all probabilities sum to 1)
- P(Ri,Rj) ≥ 0 for all outcomes
- Marginal probabilities: P(Ri) = ΣjP(Ri,Rj)
Formulas & Calculations
Expected Returns from Joint Distribution
Formula: E(Ri) = ΣΣ[Ri × P(Ri,Rj)]
Covariance Using Joint Probability
Formula: Cov(R1,R2) = ΣΣ[R1i - E(R1)][R2j - E(R2)] × P(R1i,R2j)
Correlation from Covariance
Formula: ρ12 = Cov(R1,R2) / (σ1 × σ2)
HP 12C Steps for Covariance Calculation:
- Create probability-weighted deviation products
- Sum all terms: Σ[(R1i - μ1)(R2j - μ2) × P(R1i,R2j)]
- Result is covariance
Practical Examples
Example: Joint Probability Distribution
Market Scenarios:
- Bull Market (30% probability): Stock A = 20%, Stock B = 15%
- Normal Market (50% probability): Stock A = 10%, Stock B = 8%
- Bear Market (20% probability): Stock A = -5%, Stock B = 2%
Step-by-Step Calculation:
-
Expected Returns:
- E(RA) = 0.3(20%) + 0.5(10%) + 0.2(-5%) = 9%
- E(RB) = 0.3(15%) + 0.5(8%) + 0.2(2%) = 8.9%
-
Covariance Calculation:
- Bull: (20% - 9%)(15% - 8.9%) × 0.3 = 20.13
- Normal: (10% - 9%)(8% - 8.9%) × 0.5 = -0.45
- Bear: (-5% - 9%)(2% - 8.9%) × 0.2 = 19.32
- Cov(RA,RB) = 39.0 (basis points)
-
Standard Deviations:
- σA = √[0.3(11%)² + 0.5(1%)² + 0.2(-14%)²] = 8.77%
- σB = √[0.3(6.1%)² + 0.5(-0.9%)² + 0.2(-6.9%)²] = 4.67%
-
Correlation:
- ρAB = 39.0 / (8.77 × 4.67) = 0.95
DeFi Application: Yield Aggregator Strategies
Yearn Finance Vault Analysis
Yearn Finance vaults employ multiple strategies across DeFi protocols. Understanding correlations between underlying positions is crucial for risk assessment. defi-application
Example: yvUSDC Vault Strategy Breakdown:
- Compound lending: 40% allocation
- Aave lending: 30% allocation
- Curve LP: 30% allocation
Joint Probability Scenarios:
- High DeFi activity (40%): Compound +8%, Aave +7%, Curve +12%
- Normal activity (45%): Compound +5%, Aave +4%, Curve +6%
- DeFi stress (15%): Compound +2%, Aave +1%, Curve -3%
Correlation Analysis: All strategies show positive correlation during stress events (flight to quality), reducing diversification benefits when most needed.
Learning Objective 3: Shortfall Risk and Roy’s Safety-First Criterion
Core Concept: Downside Risk Management
Roy’s Safety-First criterion addresses a fundamental concern in portfolio management: the probability of failing to meet minimum return requirements. Unlike traditional mean-variance optimization, this approach explicitly focuses on downside protection.
Key Concepts:
- Shortfall Risk: Probability that portfolio return falls below a threshold
- Threshold Return (RL): Minimum acceptable return level
- Safety-First Ratio: Standardized measure of downside protection
Formulas & Calculations
Roy’s Safety-First Ratio
Formula: SFRatio = [E(Rp) - RL] / σp formula exam-focus
Where:
- E(Rp) = Expected portfolio return
- RL = Threshold (minimum acceptable) return
- σp = Portfolio standard deviation
Shortfall Probability (Assuming Normal Distribution)
Formula: P(Rp < RL) = N[(RL - E(Rp)) / σp]
Where N(·) is the cumulative standard normal distribution function.
HP 12C Steps for Safety-First Ratio:
- Calculate excess return: [E(Rp)][ENTER][RL][-]
- Divide by standard deviation: [σp][÷]
- Result is SF Ratio
HP 12C Steps for Shortfall Probability:
- Calculate z-score: [RL][ENTER][E(Rp)][-][σp][÷]
- Use normal distribution table or calculator function
Practical Examples
Example 1: Single Portfolio Evaluation
Given:
- Portfolio A: E(Rp) = 12%, σp = 18%
- Threshold return: RL = 5%
Solution: SF Ratio = (12% - 5%) / 18% = 0.389
Interpretation: Higher SF ratio indicates lower probability of shortfall.
Example 2: Portfolio Selection
Portfolio Comparison:
- Portfolio A: E(R) = 15%, σ = 22%, RL = 8%
- Portfolio B: E(R) = 12%, σ = 16%, RL = 8%
- Portfolio C: E(R) = 10%, σ = 12%, RL = 8%
SF Ratios:
- A: (15% - 8%) / 22% = 0.318
- B: (12% - 8%) / 16% = 0.250
- C: (10% - 8%) / 12% = 0.167
Selection: Portfolio A has the highest SF ratio, making it optimal under Roy’s criterion.
Example 3: Minimum Variance Portfolio
When optimizing for Roy’s criterion, we often need to find weights that maximize the SF ratio.
For 2-asset portfolio: Optimal weight in Asset 1: w₁* = [(σ₂² - σ₁σ₂ρ₁₂) + (μ₁ - μ₂)(μ₁ - RL)] / [σ₁² + σ₂² - 2σ₁σ₂ρ₁₂ + (μ₁ - μ₂)²]
DeFi Application: Index Protocol Portfolio Construction
Index Coop DeFi Pulse Index (DPI) Analysis
The DPI token represents a diversified basket of DeFi tokens. Roy’s Safety-First criterion can guide rebalancing decisions.
Current Composition (Example):
- UNI: 15% weight, E(R) = 25%, σ = 45%
- AAVE: 12% weight, E(R) = 22%, σ = 40%
- COMP: 10% weight, E(R) = 20%, σ = 38%
- [Additional tokens…]
Rebalancing Decision Framework:
- Set threshold return based on DeFi market performance (e.g., RL = 10%)
- Calculate SF ratios for different weight allocations
- Optimize weights to maximize SF ratio
- Implement rebalancing with gas cost considerations
Example SF Calculation for DPI:
Current allocation: E(R) = 18%, σ = 35%
Threshold return: RL = 10%
SF Ratio = (18% - 10%) / 35% = 0.229
Alternative allocation optimization:
- Increase stablecoin exposure during high volatility periods
- Adjust weights based on correlation changes
- Consider gas costs in rebalancing frequency
Balancer Pool Mathematics Integration
Balancer Weighted Pools and Roy’s Criterion: Balancer pools can be analyzed as dynamic portfolios where weights change with relative price movements.
Key Considerations:
- Impermanent Loss as Shortfall Risk: Calculate probability that IL exceeds threshold
- Fee Income Offset: Include trading fees in expected return calculation
- Dynamic Rebalancing: Pool automatically rebalances, affecting risk profile
Example: 60/40 ETH/DAI Balancer Pool
- Base case: E(R) = 12% (including fees), σ = 28%
- Threshold: RL = 5% (to beat stablecoin yield)
- SF Ratio = (12% - 5%) / 28% = 0.25
Risk Factors:
- High ETH volatility increases shortfall probability
- Correlation between ETH and overall crypto market
- Smart contract risk as additional downside factor
Advanced Topics and Matrix Operations
Covariance Matrix for Multi-Asset Portfolios
For n-asset portfolios, we use matrix notation:
Portfolio Variance: σ²p = w’Σw
Where:
- w = column vector of weights
- Σ = n×n covariance matrix
- w’ = transpose of weight vector
HP 12C Matrix Operations: While the HP 12C has limited matrix capabilities, we can perform key calculations:
-
2×2 Covariance Matrix:
Σ = [σ₁² ρ₁₂σ₁σ₂] [ρ₁₂σ₁σ₂ σ₂² ] -
Portfolio Variance Calculation: σ²p = w₁²σ₁² + w₂²σ₂² + 2w₁w₂ρ₁₂σ₁σ₂
Efficient Frontier Construction
The efficient frontier represents the set of portfolios offering maximum expected return for each level of risk.
Key Points on the Frontier:
- Minimum Variance Portfolio: Lowest risk portfolio
- Maximum Sharpe Ratio Portfolio: Optimal risk-adjusted return
- Roy’s Safety-First Optimal: Highest SF ratio for given threshold
Minimum Variance Portfolio Weights (2-asset): w₁ = (σ₂² - ρ₁₂σ₁σ₂) / (σ₁² + σ₂² - 2ρ₁₂σ₁σ₂) w₂ = 1 - w₁
Risk Budgeting and Marginal Risk Contributions
Marginal Contribution to Risk: MCTRᵢ = (∂σp/∂wᵢ) = (Σw)ᵢ/σp
Risk Contribution: RCᵢ = wᵢ × MCTRᵢ
This framework helps in understanding how each asset contributes to overall portfolio risk.
Summary and Key Takeaways
Formula Reference Card
Portfolio Metrics:
- Expected Return: E(Rp) = ΣwᵢE(Rᵢ)
- Variance: σ²p = w’Σw
- Covariance: Cov(i,j) = ρᵢⱼσᵢσⱼ
- Correlation: ρᵢⱼ = Cov(i,j)/(σᵢσⱼ)
Safety-First:
- SF Ratio: [E(Rp) - RL]/σp
- Shortfall Probability: N[(RL - E(Rp))/σp]
DeFi-Specific Considerations
- Impermanent Loss: Must be factored into LP return calculations
- Smart Contract Risk: Additional downside risk not captured in traditional metrics
- Correlation Dynamics: DeFi protocols often show increased correlation during stress
- Gas Costs: Impact optimal rebalancing frequency
- Yield Farming: Temporary high returns can distort long-term risk assessment
Practical Implementation Tips
- Data Collection: Use reliable price feeds and volume data
- Correlation Estimation: Use rolling windows to capture changing relationships
- Stress Testing: Model extreme scenarios beyond normal distribution assumptions
- Regular Rebalancing: Balance risk control with transaction costs
- Risk Monitoring: Implement real-time portfolio risk tracking
This comprehensive guide provides the theoretical foundation and practical tools necessary for effective portfolio construction and risk management in both traditional finance and the rapidly evolving DeFi ecosystem.