qis.compute_risk_table¶
- qis.compute_risk_table(prices, perf_params=None)[source]¶
Compute risk metrics (vol, drawdown, skew/kurtosis) per asset using vectorised ops.
Resamples prices at the configured frequencies for vol, drawdown and skewness, then computes the return-based risk metrics column-wise on the full DataFrame and the drawdown metrics per asset. Interior gaps retain the established fill policy, while every reduction stops at the corresponding asset’s final observed price.
Grids:
VOL,DOWNSIDE_VOL,NUM_OBSand the arithmetic family use completefreq_volboundaries;SKEWNESSandKURTOSISusefreq_skewness;MAX_DD,CURRENT_DD,WORSTandBESTusefreq_drawdown(calendar days by default) followed by each asset’s final observation when that falls between boundaries, so on a coarse grid a trailing incomplete period is included andCURRENT_DDis the drawdown at the last observation.- Parameters:
prices (DataFrame) – DataFrame of asset price levels (dates × assets).
perf_params (PerfParams) – Performance parameter object. If None, a default PerfParams() is used, without inferring a frequency.
- Returns:
VOL, DOWNSIDE_VOL, AVG_LOG_RETURN, AVG_ARITH_RETURN, AN_ARITH_RETURN, AVG_ARITH_EXCESS_RETURN, AN_ARITH_EXCESS_RETURN, SHARPE_ARITH, SHARPE_ARITH_EXCESS, START_DATE, END_DATE, NUM_OBS, MAX_DD, CURRENT_DD, MAX_DD_VOL, WORST, BEST, SKEWNESS, KURTOSIS. Undefined values are missing rather than zero:
DOWNSIDE_VOLwith fewer than two negative returns, andMAX_DD_VOLwhenVOLis missing or zero.- Return type:
DataFrame indexed by asset with risk metric columns including
- Raises:
TypeError – If
pricesis not a DataFrame.