qis.compute_periodic_returns

qis.compute_periodic_returns(prices, freq='ME', time_period=None, total_name=None, add_total=True, date_format=None, **kwargs)[source]

Compute simple periodic returns for a price panel.

Parameters:
  • prices (DataFrame) – Price levels with dates on the index and assets in columns.

  • freq (str) – Frequency used to sample return boundaries.

  • time_period (TimePeriod) – Optional date interval applied before return calculation.

  • total_name (str) – Label for the optional whole-period return row.

  • add_total (bool) – Whether to append a whole-period return row.

  • date_format (str) – Optional strftime format for periodic row labels.

  • **kwargs – Reserved for compatibility with plotting callers.

Returns:

Periods by assets. A column remains missing until it supplies two observed price boundaries; internal and trailing gaps retain the established forward-fill behavior.

Raises:

ValueError – If prices is not a DataFrame.

Return type:

DataFrame