Portfolio Risk Aggregation | DeFi Risk Management | XRP Academy - XRP Academy
3 free lessons remaining this month

Free preview access resets monthly

Upgrade for Unlimited
Skip to main content
advanced60 min

Portfolio Risk Aggregation

Learning Objectives

Understand why individual risk ≠ portfolio risk and how correlations affect aggregate risk

Calculate concentration metrics including HHI and effective number of positions

Decompose portfolio risk by factor (market, protocol, counterparty, etc.)

Estimate portfolio-level VaR using scenario-based methods

Construct a risk dashboard that displays portfolio-level risk metrics

You've scored each protocol, assessed each position—but what's your total risk?

THE AGGREGATION FALLACY

The intuition:
├── Position A: 10% risk
├── Position B: 10% risk
├── Position C: 10% risk
├── Portfolio risk: 10%? (Average)
├── Or 30%? (Sum)
└── Neither is correct

Why neither:

Averaging is wrong because:
├── Risks don't average
├── One position failing = loss
├── Risk is not return
└── 10% + 10% ≠ 10%

Summing is wrong because:
├── Ignores diversification
├── Assumes all fail together
├── Correlations matter
└── 10% + 10% ≠ 20%

The reality:
├── Depends on correlations
├── Depends on failure modes
├── Depends on what "risk" means
├── Portfolio construction matters
└── Need systematic aggregation


---
CORRELATION AND PORTFOLIO RISK

Independent risks:
├── If A fails, B unaffected
├── Probability both fail = P(A) × P(B)
├── 10% × 10% = 1% both fail
├── Diversification works
└── Portfolio risk < sum of individual

Perfectly correlated risks:
├── If A fails, B fails too
├── Probability both fail = P(A) = P(B)
├── Both fail together: 10%
├── No diversification benefit
└── Portfolio risk = individual risk

DeFi reality:
├── Risks are partially correlated
├── Market crashes affect everything
├── Protocol-specific risks less correlated
├── Counterparty risks can be correlated
└── Need to estimate correlations

CORRELATION TYPES IN DEFI:

Market risk correlation: HIGH
├── Bear market hits all positions
├── XRP down = most positions down
├── Cannot diversify away
└── Accept as market exposure

Protocol risk correlation: LOW-MODERATE
├── Protocol A exploit ≠ Protocol B exploit
├── But: Shared code (forks) increases
├── Similar designs may share vulnerabilities
└── Some diversification possible

Counterparty risk correlation: MODERATE
├── USDC failure affects all USDC positions
├── Different counterparties are independent(ish)
├── Banking system stress = correlated
└── Limited diversification
```

PORTFOLIO RISK DECOMPOSITION

Market Risk:
├── Broad market movements
├── XRP price changes
├── Crypto market correlation
├── Cannot be diversified within crypto
└── Hedge with position sizing or non-crypto

Protocol Risk:
├── Smart contract bugs
├── Economic design failure
├── Governance attacks
├── Protocol-specific events
└── Diversify across protocols

Counterparty Risk:
├── Stablecoin issuer failure
├── Bridge compromise
├── Gateway default
├── Concentrated in fewer entities
└── Diversify across counterparties

Liquidity Risk:
├── Exit slippage
├── Correlated during crises
├── Market-wide liquidity crunch
└── Position sizing based on exit capacity

Regulatory Risk:
├── Government actions
├── Enforcement actions
├── Often market-wide impact
└── Geographic diversification helps

PORTFOLIO RISK = f(Market, Protocol, Counterparty, Liquidity, Regulatory)
```

RISK FACTOR CONTRIBUTION

Step 1: Identify risk factors
├── Market factor (XRP price, BTC correlation)
├── Protocol factors (per protocol)
├── Counterparty factors (per counterparty)
├── Liquidity factors
└── Other specific factors

Step 2: Estimate factor exposures
For each position:
├── How much market risk?
├── Which protocol risk?
├── Which counterparty risks?
├── Liquidity characteristics
└── Map position to factors

Step 3: Aggregate by factor
├── Sum exposures to each factor
├── Identify concentrated factors
├── Most exposure = most risk
└── Where are you concentrated?

EXAMPLE:
Portfolio: 3 positions

Position 1 (40%):
├── Market: 40% (all in XRP)
├── Protocol A: 40%
├── Circle (USDC): 20%
└── Liquidity: Good

Position 2 (35%):
├── Market: 35%
├── Protocol B: 35%
├── Circle (USDC): 17.5%
└── Liquidity: Moderate

Position 3 (25%):
├── Market: 25%
├── Protocol C: 25%
├── Ripple (RLUSD): 12.5%
└── Liquidity: Good

Factor Exposures:
├── Market: 100% (everything is XRP-correlated)
├── Protocol A: 40%, B: 35%, C: 25%
├── Circle: 37.5%
├── Ripple: 12.5%
└── Insight: Market risk is dominant, reasonable protocol spread
```


HHI CALCULATION

Formula:
HHI = Σ(weight²)

Where weight = position as decimal (e.g., 25% = 0.25)

Properties:
├── Range: 0 to 1 (or 0 to 10,000 if using percentages)
├── Lower = more diversified
├── Equal positions minimize HHI
├── HHI = 1 means single position
└── HHI = 1/n for n equal positions

EXAMPLE:
Position weights: 40%, 35%, 25%

HHI = 0.40² + 0.35² + 0.25²
HHI = 0.16 + 0.1225 + 0.0625
HHI = 0.345

INTERPRETATION:
├── HHI < 0.15: Well diversified
├── HHI 0.15-0.25: Moderate concentration
├── HHI 0.25-0.40: Concentrated
├── HHI > 0.40: Highly concentrated
└── 0.345 = Concentrated
```

EFFECTIVE POSITIONS CALCULATION

Formula:
Effective N = 1 / HHI

Intuition:
├── How many equal-sized positions would have same HHI?
├── Captures concentration in single number
├── 5 positions but one is 80%? Effective ≈ 1.5
└── More intuitive than raw HHI

EXAMPLE (continuing):
HHI = 0.345
Effective N = 1 / 0.345 = 2.9

You have 3 positions but effective diversification of ~2.9

TARGETS:
├── Effective N > 4: Reasonably diversified
├── Effective N 2-4: Somewhat concentrated
├── Effective N < 2: Highly concentrated
└── Aim for Effective N matching your position count

COMPARISON:
Equal allocation (33%, 33%, 33%):
├── HHI = 3 × 0.333² = 0.333
├── Effective N = 3.0
└── Full diversification benefit

Current allocation (40%, 35%, 25%):
├── HHI = 0.345
├── Effective N = 2.9
└── Close to optimal for 3 positions
```

CONCENTRATION LIMIT FRAMEWORK

Position Concentration:
├── Single position max: 25%
├── Top 3 positions max: 60%
├── Effective N target: > 4
└── HHI target: < 0.25

Protocol Concentration:
├── Single protocol max: 25%
├── Protocol family max: 35% (forks share code)
├── Track protocol exposure, not just position
└── Same protocol in multiple positions = concentrated

Asset Concentration:
├── Single asset max: 40%
├── Stablecoin-heavy: Issuer concentration
├── XRP-heavy: Market concentration
└── Diversify across asset types

Counterparty Concentration:
├── Single counterparty max: 25%
├── Stablecoin issuer max: 40%
├── Bridge max: 30%
└── Aggregate all exposure paths

CHECKING CONCENTRATION:
For portfolio, calculate:
├── Position HHI (actual positions)
├── Protocol HHI (aggregate by protocol)
├── Asset HHI (aggregate by asset)
├── Counterparty HHI (aggregate by counterparty)
└── All should meet thresholds
```

CONCENTRATION METRICS TEMPLATE

POSITION CONCENTRATION:
├── Largest position: ___% (limit: 25%)
├── Top 3 positions: ___% (limit: 60%)
├── Position HHI: _____ (target: < 0.25)
├── Effective positions: _____ (target: > 4)
└── Status: PASS / FAIL

PROTOCOL CONCENTRATION:
├── Largest protocol: ___% (limit: 25%)
├── Protocol HHI: _____
├── Effective protocols: _____
└── Status: PASS / FAIL

COUNTERPARTY CONCENTRATION:
├── Largest counterparty: ___% (limit: 25%)
├── Stablecoin issuer max: ___% (limit: 40%)
├── Counterparty HHI: _____
└── Status: PASS / FAIL

OVERALL CONCENTRATION: PASS / FAIL
```


PORTFOLIO VAR METHODOLOGY

Why scenario-based:
├── DeFi lacks long historical data
├── Correlations unstable
├── Fat tails don't fit normal
├── Scenario analysis more robust
└── Can incorporate protocol-specific risks

Step 1: Define scenarios
For each scenario:
├── What market conditions?
├── What protocol events?
├── What counterparty events?
├── Probability estimate
└── Duration

Step 2: Calculate position impact
For each position in each scenario:
├── Market impact (price change)
├── Protocol impact (exploit, economic failure)
├── Counterparty impact
├── Liquidity impact (slippage)
└── Total position impact

Step 3: Aggregate portfolio impact
For each scenario:
├── Sum position impacts (weighted by size)
├── Consider correlations
├── Maximum loss
├── Expected loss
└── Probability-weighted

Step 4: Determine VaR
├── Sort scenarios by loss
├── Find 95th percentile loss
├── That's your VaR(95%)
└── Also note worst-case (CVaR)
```

STANDARD SCENARIO SET

Scenario 1: Market Crash
├── Probability: 15%/year
├── Market: XRP -50%, ETH -40%
├── Protocol failures: 2% of positions
├── Counterparty issues: USDT/USDC hold peg
├── Liquidity: 2x normal slippage
└── Impact: High

Scenario 2: Protocol Exploit (Single)
├── Probability: 5%/year per protocol
├── Affected protocol: -100%
├── Other protocols: Unaffected
├── Market: -10% (contagion)
├── Your loss: Position size in affected protocol
└── Impact: Depends on concentration

Scenario 3: Stablecoin De-peg
├── Probability: 3%/year major issuer
├── Affected stablecoin: -10% to -50%
├── Market: -20% (contagion)
├── Other stables: Minor pressure
├── Positions using stable: Proportional loss
└── Impact: Depends on stable concentration

Scenario 4: Contagion/Systemic
├── Probability: 5%/year
├── Market: -60%
├── Protocol failures: 10% of positions
├── Counterparty stress: Moderate
├── Liquidity: 5x normal slippage
└── Impact: Very high

Scenario 5: Normal Volatility
├── Probability: 75%/year
├── Market: ±20%
├── Protocol failures: 0.5%
├── Counterparty: Stable
├── Liquidity: Normal
└── Impact: Manageable
```

PORTFOLIO VAR EXAMPLE

Portfolio:
├── Position A: 35% in XRP/USDC LP (Protocol X)
├── Position B: 30% in Lending (Protocol Y)
├── Position C: 20% in XRP/RLUSD LP (Protocol Z)
├── Position D: 15% in XRP spot

Portfolio value: $100,000

Scenario Analysis:

Scenario 1: Market Crash (-50% XRP)
├── Position A: -35% (50% XRP exposure + IL)
├── Position B: -15% (some XRP collateral)
├── Position C: -35%
├── Position D: -50%
├── Portfolio loss: ~35%
├── Probability: 15%
└── P × Loss: 5.25%

Scenario 2: Protocol X Exploit
├── Position A: -100%
├── Others: -5% (market reaction)
├── Portfolio loss: 35% + 3% = 38%
├── Probability: 5%
└── P × Loss: 1.9%

Scenario 3: USDC De-peg (-20%)
├── Position A: -10% (50% USDC)
├── Position B: -6% (30% USDC)
├── Others: -5% (market reaction)
├── Portfolio loss: ~8%
├── Probability: 3%
└── P × Loss: 0.24%

Scenario 4: Contagion
├── Portfolio loss: ~55%
├── Probability: 5%
└── P × Loss: 2.75%

Scenario 5: Normal
├── Portfolio loss: ~5% (expected volatility)
├── Probability: 72%
└── P × Loss: 3.6%

VaR(95%) Estimate:
├── 5% worst scenarios = Scenario 4 + part of 1
├── VaR(95%, 1 year) ≈ -50%
├── Dollar VaR = $50,000
└── Meaning: 95% confident won't lose more than $50K in a year


---
PORTFOLIO RISK DASHBOARD

SECTION 1: Portfolio Summary
├── Total DeFi value: $_______
├── % of crypto portfolio: ___%
├── % of net worth: ___%
├── Number of positions: ___
└── Last updated: ________

SECTION 2: Position Overview

Position Protocol Value % Score Risk
Pos 1 Proto A $ % /10 L/M/H
Pos 2 Proto B $ % /10 L/M/H
... ... ... ... ... ...
Total $ 100 Avg

SECTION 3: Concentration Metrics
├── Position HHI: _____ (limit: 0.25)
├── Effective positions: _____ (target: >4)
├── Largest position: ___% (limit: 25%)
├── Protocol HHI: _____
├── Counterparty exposure: (table)
└── Status: PASS / WARN / FAIL

SECTION 4: Risk Metrics
├── VaR(95%, 30-day): $_______
├── CVaR(95%, 30-day): $_______
├── Maximum drawdown limit: ___%
├── Portfolio risk score (weighted avg): /10
└── Stress test survival: Y/N

SECTION 5: Alerts
├── Active alerts: (list)
├── Positions near limits: (list)
├── Upcoming expirations/events: (list)
└── Monitoring items: (list)
```

DASHBOARD IMPLEMENTATION

Tool options:

Spreadsheet (Recommended for most):
├── Google Sheets or Excel
├── Manual position entry
├── Formulas for calculations
├── Charts for visualization
├── Free, customizable
└── Requires manual updates

Portfolio trackers + Export:
├── DeBank, Zapper for position data
├── Export to spreadsheet
├── Add custom risk calculations
├── Hybrid approach
└── Less manual, some automation

Custom dashboard:
├── Code your own (Python, etc.)
├── API integration for positions
├── Automated calculations
├── Full customization
└── Technical effort required

MINIMUM VIABLE DASHBOARD:
├── Position list with values
├── HHI calculation
├── Counterparty concentration
├── Scenario impact estimates
├── Update weekly minimum
└── Start simple, add complexity
```

DASHBOARD REVIEW SCHEDULE

Daily:
├── Check for alerts
├── Position value changes > 10%
├── Protocol/counterparty news
├── Quick health check
└── 5-10 minutes

Weekly:
├── Full dashboard update
├── Concentration check
├── New information review
├── Rebalancing assessment
├── Protocol score updates if needed
└── 30-60 minutes

Monthly:
├── Comprehensive review
├── VaR recalculation
├── Stress test refresh
├── Strategy assessment
├── Framework refinement
└── 2-3 hours

Quarterly:
├── Full framework review
├── Methodology updates
├── Historical performance analysis
├── Risk tolerance reassessment
├── Major rebalancing
└── Half day

Event-driven:
├── Major market move (>20%)
├── Protocol incident
├── Counterparty news
├── Regulatory announcement
├── Immediate review
```


Concentration increases risk. Multiple concentrated positions have failed spectacularly.

Diversification provides protection. Spreading risk reduces portfolio-level volatility.

Correlations matter. Correlated positions don't provide diversification benefits.

⚠️ Correlation stability. Correlations change, especially in crisis.

⚠️ Probability estimates. Scenario probabilities are educated guesses.

⚠️ Fat tail behavior. Extreme events may be more extreme than modeled.

📌 False diversification. Many positions with same risk factors = not diversified.

📌 Ignoring correlations. Adding positions that move together adds risk.

📌 VaR as ceiling. VaR is not maximum loss; worst case can be worse.


Assignment: Build a comprehensive risk dashboard for your DeFi portfolio.

Requirements:

  1. Position inventory with values and percentages
  2. Concentration metrics (HHI, effective positions)
  3. Risk factor decomposition
  4. Counterparty concentration table
  5. Scenario impact analysis (minimum 3 scenarios)
  6. Portfolio VaR estimate
  7. Alert thresholds defined
  8. Review schedule documented

Time investment: 3 hours


1. Your portfolio has positions of 45%, 30%, 25%. What's the HHI?
A) 1.0 B) 0.365 C) 0.333 D) 3.0

Correct Answer: B (0.45² + 0.30² + 0.25² = 0.2025 + 0.09 + 0.0625 = 0.355, rounds to ~0.36)

2. If HHI = 0.20, what's the effective number of positions?
A) 2 B) 5 C) 10 D) 20

Correct Answer: B (1/0.20 = 5)

3. Why doesn't portfolio risk equal the sum of individual position risks?
A) Position risks are measured wrong B) Diversification reduces correlated losses C) Risk always cancels out D) Individual risks don't matter

Correct Answer: B


End of Lesson 9

Key Takeaways

1

Individual position risk doesn't sum to portfolio risk.

Correlations and concentration effects matter.

2

HHI and effective positions measure concentration.

Target HHI < 0.25, effective positions > 4.

3

Decompose risk by factor.

Market, protocol, counterparty—where are you concentrated?

4

Use scenario-based VaR for DeFi.

Historical methods don't work with limited data.

5

Build and maintain a risk dashboard.

Systematic tracking enables better decisions. ---