qis.prices_at_freq

qis.prices_at_freq(prices, freq=None, include_start_date=False, include_end_date=False, ffill_nans=True, fill_na_method='ffill')[source]

Resample prices to specified frequency.

Parameters:
  • prices (Series | DataFrame) – Price time series

  • freq (str | None) – Target frequency (e.g., ‘D’, ‘W’, ‘M’)

  • include_start_date (bool) – Include period start in resampling

  • include_end_date (bool) – Include period end in resampling

  • ffill_nans (bool) – Forward-fill NaN values. With freq set, the fill is applied on the source grid and at the boundaries when prices are resampled. Input whose inferred frequency already equals freq is returned unchanged, missing values included: on its own grid a missing value is a missing observation, and filling it would manufacture a zero return. Pass freq=None to fill such input

  • fill_na_method (str | None) – Method for filling NaN (‘ffill’, ‘bfill’, None) when freq is None

Returns:

Resampled price time series

Return type:

Series | DataFrame

Note

A prices index that is not in chronological order is sorted first: the fill below runs in row order, and every return computed downstream differences adjacent rows.