macrosynergy.management.utils.frequency#

Infer per-observation release frequency from the spacing of end-of-period (eop) dates.

infer_release_frequency(eop, window=3, freqs=('D', 'W', 'M', 'Q', 'A'))[source]#

Classify the release frequency of each observation from its local eop cadence.

The gap (in days) between consecutive distinct eop dates is smoothed with a rolling median (window, min_periods=1) and snapped to the nearest supported frequency by log-distance to the reference period length (365.25 / ANNUALIZATION_FACTORS). Observations sharing an eop (revisions) inherit that period’s frequency.

Parameters:
  • eop (pd.Series) – per-observation end-of-period dates (datetime); the index is preserved.

  • window (int) – rolling-median window over distinct-eop gaps. Default 3.

  • freqs (Tuple[str, ...]) – candidate frequency labels. Default (“D”, “W”, “M”, “Q”, “A”).

Returns:

per-observation frequency labels, aligned to the input index.

Return type:

pd.Series

Raises:

ValueError – if there are fewer than two distinct eop dates, so no gap can be computed to estimate a release frequency.