qis.plot_regime_data¶
- qis.plot_regime_data(regime_classifier, regime_data_to_plot=RegimeData.REGIME_SHARPE, drop_sharpe_from_labels=False, drop_benchmark=False, x_rotation=90, add_bar_values=True, title='Conditional Sharpe ratio', var_format='{:.1f}', bbox_to_anchor=(1.0, 0.95), fontsize=10, is_top_totals=True, is_add_totals=True, is_use_vbar=False, reverse_columns=True, legend_loc='upper right', ax=None, **kwargs)[source]¶
plot regime-conditional data of the classifier as stacked bars with regime colors.
for regime_data_to_plot=RegimeData.REGIME_SHARPE the values are regime contributions that follow perf_params.sharpe_convention (see qis/docs/sharpe_conventions.md): PA (default) divides the additivity-patched compound per-annum regime contributions by the annualized vol
VOL, so the bars add up toPA_RETURN / VOL, which equalsSHARPE_RF0only when the native endpoints lie on thefreq_volgrid. ARITHMETIC computes sr_s = sqrt(af) * p_s * m_s / std(r) on the sampled simple returns, so the regime bars sum to the arithmetic Sharpe ratio on the regime grid exactly; LOG is the analog on log(1+r). The additive conventions are the natural choice for regime attribution. No convention deducts cash; state the convention in the title when it matters.- Parameters:
regime_classifier (RegimeClassifier) – classifier whose
compute_regimes_pa_perf_tablereceivesprices,benchmarkandperf_paramsfromkwargsregime_data_to_plot (RegimeData) – panel to draw: regime averages, p.a. contributions or Sharpe contributions
drop_sharpe_from_labels (bool) – remove ‘ Sharpe’ from the regime labels
drop_benchmark (bool) – Exclude the benchmark from the rendered regime bars while leaving the classifier’s component tables unchanged.
title (str | None) – panel title; the default names a conditional Sharpe ratio, of total returns
is_add_totals (bool) – show each asset’s row sum of the drawn panel, skipping missing regimes
x_rotation (int)
add_bar_values (bool)
var_format (str)
fontsize (int)
is_top_totals (bool)
is_use_vbar (bool)
reverse_columns (bool)
legend_loc (str | None)
ax (Axes)
- Returns:
the figure
- Return type: