qis.portfolio_returns_to_nav

qis.portfolio_returns_to_nav(returns, init_period=1, init_value=None, freq=None)[source]

Aggregate portfolio returns across assets to single NAV.

NaN handling: uses nansum across columns — a NaN contribution on a given date is treated as 0 PnL, equivalent to “this asset held its notional but earned 0% that period”. A date on which every contribution is NaN has a NaN portfolio return, exactly as in to_portfolio_returns: the NAV is carried flat through such a date inside the history and, as returns_to_nav does for any trailing missing returns, ends at the last date with an observed contribution. See to_portfolio_returns docstring for the full discussion.

Parameters:
  • returns (DataFrame) – Per-asset return contributions, with assets as columns

  • init_period (int | None) – 1 sets the first row’s aggregate return to zero, observed or not, so the NAV equals one on the first date and that row’s contribution is discarded; 0 sets the missing row before the first observed aggregate return to zero; None leaves the aggregate unchanged

  • init_value (ndarray | float) – Initial NAV value

  • freq (str | None) – Resampling frequency

Returns:

Aggregate portfolio NAV series

Return type:

Series | DataFrame