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_tfromcompute_ra_returns(span, when given, is its volatility span). For each calendar period J offreqthe output issum_{t in J} x_t, divided withis_norm=Truebysqrt(n_J), wheren_Jis the number of finitex_tin 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'returnx_tunchangedspan (int) – EWM span of the volatility; overrides
ewm_lambdaewm_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_lagofcompute_ra_returnsis_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 asresample(freq)labels it- Return type: