qis.compute_turnover

qis.compute_turnover(computation_type=TurnoverComputationType.EXECUTED_NOTIONAL_NAV, units=None, unit_notional=None, nav=None, input_weights=None, vols=None)[source]

Compute per-instrument two-sided turnover before resampling or rolling aggregation.

Executed turnover values unit changes with the current date’s unit notional. For cash securities this is normally the asset price. For derivatives it is the full contract notional, including multiplier and currency conversion. Target-weight turnover is retained as an explicit proxy for backtests that do not carry executed holdings. Volatility-normalized weight turnover is annualized_volatility[t] * abs(weight[t] - weight[t-1]). It uses target weights rather than drifted holdings because it is a theoretical signal-turnover measure. Dated inputs are ordered chronologically on local objects before changes or alignment; non-dated indexes retain their supplied row order. Narrow integers and unsigned 64-bit levels within signed 64-bit capacity are widened before arithmetic. Other wide integer arithmetic retains its existing overflow limitations.

Parameters:
  • computation_type (TurnoverComputationType) – Holdings and denominator convention. The default is executed traded notional divided by portfolio NAV.

  • units (DataFrame | None) – Executed units or contracts held on each date. Required by both executed modes.

  • unit_notional (DataFrame | None) – Current value of one unit or contract. Required by both executed modes; aligned values used in the calculation must be finite and non-negative while missing values propagate.

  • nav (Series | None) – Portfolio NAV in the same currency as unit_notional. Required by EXECUTED_NOTIONAL_NAV.

  • input_weights (DataFrame | None) – Requested target weights. Required by TARGET_WEIGHTS and VOLATILITY_NORMALIZED_WEIGHTS.

  • vols (DataFrame | None) – Annualized fractional volatility for each target weight. Required by VOLATILITY_NORMALIZED_WEIGHTS and required to have exactly the same dated index after chronological ordering, columns, and column order as input_weights. Observed values must be finite and non-negative; warm-up NaNs are preserved.

Returns:

Per-instrument two-sided turnover on the input index, ordered chronologically for dated inputs. The first row is normally missing because no preceding holding is available. Nullable integer target-weight results may widen to Int64.

Raises:
  • TypeError – If a required input is not a pandas object of the expected type.

  • ValueError – If unit_notional does not contain every unit column, if an aligned unit_notional value or an observed vols value is negative or infinite, if vols is not exactly aligned, if an applicable dated input contains duplicate or NaT dates, or if the computation type is unsupported.

Return type:

DataFrame