qis.adjust_component_navs_to_portfolio¶
- qis.adjust_component_navs_to_portfolio(portfolio_nav, component_navs)[source]¶
Rescale component NAVs so their PA returns sum to the portfolio PA return.
Used for portfolio NAV decomposition: when a portfolio’s total return is expressed as a sum of additive components (carry types, fundamental return sources, gross vs net vs costs, etc.), the per-annum returns of the corresponding component NAVs don’t automatically sum to the portfolio’s — geometric compounding introduces a residual gap from the linear additivity of period returns. This function rescales each component NAV by a common time-weighted factor that closes the gap in per-annum returns.
Formula:
c_m(t) = ((portfolio_pa / n + 1) / (mean(component_pa) + 1)) ** t
where
nis the number of components andtis years-from-start (days / 365.25). For truly additive components,mean(component_pa) ≈ portfolio_pa / nandc_mis close to 1 — only a small adjustment is applied.Each component is rescaled by the same
c_m(t), preserving the relative contributions of components. When the history spans more than one year and every component is observed on the portfolio’s first and last dates, the rescaled components’ per-annum returns sum exactly to the portfolio’s per-annum return. The rescaled NAVs themselves do not sum to the portfolio NAV at any date, including the terminal one: each starts near one, so n components sum to about n. Intended use is display / stacked-area charting of per-annum contributions, not formal attribution.When both inputs have the same unique, non-missing timestamps, adjustment factors are matched by timestamp regardless of component row order. The time origin remains the first stored row of
portfolio_nav.- Parameters:
- Returns:
DataFrame of rescaled component NAVs, same columns as input.
- Return type: