qis.PerfParams¶
- class qis.PerfParams(freq=None, freq_vol='ME', freq_skewness='ME', freq_drawdown='D', freq_reg='QE', freq_excess_return='ME', return_type=ReturnTypes.LOG, sharpe_convention=SharpeConvention.PA, rates_data=None)[source]¶
Bases:
objectsampling frequencies and conventions for risk-adjusted performance statistics.
Every statistic is frequency-relative: volatility computed on monthly returns is not the same number as volatility computed on daily returns, and the ratio is not a rescaling. The frequencies are therefore explicit here rather than assumed, and each factsheet panel states the frequency it was computed at. See
qis/docs/reporting_frequencies.md.Passing
freqsetsfreq_vol,freq_regandfreq_excess_returnto the same value. It setsfreq_drawdownonly when that field is passed as None: the defaultfreq_drawdown='D'is kept, soPerfParams(freq='ME')still measures drawdowns on calendar days.freq_skewnessis never set byfreq. The per-statistic fields are for the cases where one statistic needs a different grid from the rest.- Variables:
freq (str) – single frequency applied to the fields listed above; None keeps them independent and defaults
freqitself to ‘ME’freq_vol (str) – sampling for volatility, and therefore the Sharpe denominator; also the grid of the ratio numerators and of
NUM_OBSfreq_skewness (str) – sampling for skewness and kurtosis
freq_drawdown (str) – sampling for drawdowns and for the
WORSTandBESTreturns; ‘D’ keeps the peak-to-trough path at native resolution rather than on the reporting grid. A coarser grid keeps each asset’s final observation, soCURRENT_DDis the drawdown at the last observationfreq_reg (str) – sampling for linear and quadratic regressions against a benchmark
freq_excess_return (str) – stored, printed and copied for compatibility but not read by any calculation; excess returns are formed on the grid of the statistic that uses them
return_type (qis.perfstats.config.ReturnTypes) – log or arithmetic returns for the volatility computation
sharpe_convention (qis.perfstats.config.SharpeConvention) – which Sharpe object the regime-conditional Sharpe contributions report — compound p.a., arithmetic, or log. PA is the default and leaves every existing output unchanged; the table’s Sharpe columns do not depend on it. See
qis/docs/sharpe_conventions.mdrates_data (pandas.Series | None) – risk-free rate series deducted by the excess-return columns (
PA_EXCESS_RETURN,SHARPE_EXCESS,SORTINO_RATIO,CALMAR_RATIOand the other excess members) and by benchmark regressions. Without it every excess column equals its zero-rate counterpart; it is not an error to omit it
- Parameters:
freq (str)
freq_vol (str)
freq_skewness (str)
freq_drawdown (str)
freq_reg (str)
freq_excess_return (str)
return_type (ReturnTypes)
sharpe_convention (SharpeConvention)
rates_data (Series | None)
- __init__(freq=None, freq_vol='ME', freq_skewness='ME', freq_drawdown='D', freq_reg='QE', freq_excess_return='ME', return_type=ReturnTypes.LOG, sharpe_convention=SharpeConvention.PA, rates_data=None)¶
- Parameters:
freq (str)
freq_vol (str)
freq_skewness (str)
freq_drawdown (str)
freq_reg (str)
freq_excess_return (str)
return_type (ReturnTypes)
sharpe_convention (SharpeConvention)
rates_data (Series | None)
- Return type:
None
Methods
__init__([freq, freq_vol, freq_skewness, ...])copy([freq_reg, freq_vol, freq_drawdown, ...])a copy with the given fields replaced and every other field kept.
print()Attributes
- return_type: ReturnTypes = 'Log'¶
- sharpe_convention: SharpeConvention = 1¶
- copy(freq_reg=None, freq_vol=None, freq_drawdown=None, freq_excess_return=None, return_type=None, rates_data=None, sharpe_convention=None, freq_skewness=None, **kwargs)[source]¶
a copy with the given fields replaced and every other field kept.
freqis carried over as stored; it is not re-applied, so the copy keeps the per- statistic frequencies of this object or the ones passed here.- Parameters:
freq_reg (str) – replacement
freq_reg; None keeps the current valuefreq_vol (str) – replacement
freq_vol; None keeps the current valuefreq_drawdown (str) – replacement
freq_drawdown; None keeps the current valuefreq_excess_return (str) – replacement
freq_excess_return; None keeps the current valuereturn_type (ReturnTypes) – replacement
return_type; None keeps the current valuerates_data (Series) – replacement
rates_data; None keeps the current seriessharpe_convention (SharpeConvention) – replacement
sharpe_convention; None keeps the current valuefreq_skewness (str) – replacement
freq_skewness; None keeps the current value**kwargs – ignored, for compatibility with callers passing report settings
- Returns:
a new PerfParams
- Return type: