Calculation contract
RC_i = w_i*(S*w)_i / sigma_p; risk_share_i = RC_i / sigma_p| Input | Allowed values | Meaning |
|---|---|---|
| weights | Two nonnegative decimals summing to one | Capital fractions |
| covariance | Symmetric PSD 2x2 matrix; entries -100 to 100 | Ordered, same-frequency covariance; nonnegative diagonal |
Method and interpretation
The marginal derivative of volatility is scaled by each capital weight to obtain its Euler contribution. In the default example, the contribution numerators are 0.01584 and 0.00304. Dividing each by total variance gives risk shares of approximately 83.8983% and 16.1017%, despite capital weights of 60% and 40%.
A negative contribution is possible when an exposure offsets the rest of the portfolio strongly enough. The signed contributions still add to total volatility; forcing every value to be nonnegative would destroy that reconciliation.
Where the reference stops
At zero total volatility the division is undefined, so contribution arrays are null rather than invented zeros. These are local variance-based allocations, not loss attribution in a stress event or a recommendation to remove a hedging exposure.
Published synthetic inputs
{
"weights": [
0.6,
0.4
],
"covariance": [
[
0.04,
0.006
],
[
0.006,
0.01
]
]
}Frozen calculation output
{
"variance": 0.01888,
"volatility": 0.13740451229854134,
"component_volatility": [
0.11528005692843722,
0.02212445537010412
],
"risk_shares": [
0.8389830508474576,
0.1610169491525424
]
}Signed Euler contributions sum to portfolio volatility; individual contributions can be negative.
Two aligned long-only weights and a same-frequency covariance matrix. No additional annualization is applied.
Verification coverage
- Euler sum and risk-share sum reconciled; negative contribution fixture tested.
- Zero-volatility outputs explicitly withheld.
Unit and independent-reference checks test arithmetic and rejection rules, not future investment performance.
Method references
Read the assumptions in context
Allocation referencesWhen Inverse Volatility Is, and Is Not, Risk Parity
Inverse-volatility weights equalize weighted standalone volatility. Equal portfolio risk contributions require correlation information except in special cases.
Risk measurementComponent Risk Contributions Are Not Capital Weights
Volatility contributions allocate a portfolio-level estimate. They can be negative or exceed the total, even when every capital weight is positive.