qis.compute_sum_freq_ra_returns

qis.compute_sum_freq_ra_returns(returns, freq='B', span=None, ewm_lambda=0.94, vol_target=None, weight_shift=1, is_log_returns_to_arithmetic=True, is_norm=True, warmup_period=None)[source]

sum risk-adjusted returns within non-overlapping calendar periods of freq.

The terms are x_t from compute_ra_returns (span, when given, is its volatility span). For each calendar period J of freq the output is sum_{t in J} x_t, divided with is_norm=True by sqrt(n_J), where n_J is the number of finite x_t in J. For uncorrelated unit-variance terms the normalised sums then have unit variance whatever the frequency and however many observations a period holds; a period without observations is missing. Interpretation: the P&L over each period of the per-period volatility-targeted position, in units of its own period volatility.

Parameters:
  • returns (Series | DataFrame) – periodic returns, usually business-daily

  • freq (str) – calendar frequency of the sums. 'B' and 'D' return x_t unchanged

  • span (int) – EWM span of the volatility; overrides ewm_lambda

  • ewm_lambda (float) – EWM decay of the volatility

  • vol_target (float | None) – per-period volatility target; None is a unit target

  • weight_shift (int | None) – lag of the volatility normaliser, weight_lag of compute_ra_returns

  • is_log_returns_to_arithmetic (bool) – map log returns to simple returns before scaling

  • is_norm (bool) – divide each period’s sum by the root of its observation count; False returns the plain sums, with zero for a period without observations

  • warmup_period (int | None) – number of leading volatility estimates set to missing

Returns:

one row per calendar period of freq, labelled as resample(freq) labels it

Return type:

Series | DataFrame