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_OBS and the arithmetic family use complete freq_vol boundaries; SKEWNESS and KURTOSIS use freq_skewness; MAX_DD, CURRENT_DD, WORST and BEST use freq_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 and CURRENT_DD is 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_VOL with fewer than two negative returns, and MAX_DD_VOL when VOL is missing or zero.

Return type:

DataFrame indexed by asset with risk metric columns including

Raises:

TypeError – If prices is not a DataFrame.