qis.SmartDiversificationReport

class qis.SmartDiversificationReport(overlay_navs, principal_nav=None, regime_classifier=None, perf_params=None, benchmark_description=None)[source]

Bases: object

Diversification frontiers of candidate overlays stacked on a principal portfolio.

The fixed-principal mixes hold the principal at full weight and the overlay on top, and the backtest finances that leverage at a zero rate. Pass excess-of-cash navs for both, as for the stacked portfolio r_B + w r_A of Sepp and Kastenholz (2026, Definition 3); total-return navs overstate every levered mix by the overlay weight times the cash return.

The defaults are quarterly regimes and the per-annum Sharpe convention. The paper’s settings are monthly regimes and the arithmetic Sharpe ratio of its equation (2):

SmartDiversificationReport(
    overlay_navs=excess_overlay_navs, principal_nav=excess_principal_nav,
    regime_classifier=qis.BenchmarkReturnsQuantilesRegime(freq='ME'),
    perf_params=qis.PerfParams(freq='ME',
                               sharpe_convention=qis.SharpeConvention.ARITHMETIC))

with rebalancing_freq='ME' in the curve methods, so that each mix return is the weighted sum of the monthly returns, up to the rebalancing dates.

Variables:
  • overlay_navs (pandas.DataFrame) – navs of the candidate overlays, one column per overlay

  • principal_nav (pandas.Series) – nav of the principal portfolio, also the regime benchmark

  • regime_classifier (qis.perfstats.regime_classifier.BenchmarkReturnsQuantilesRegime) – classifier of the benchmark regimes; None uses BenchmarkReturnsQuantilesRegime(), quarterly at the 16%/84% quantiles

  • perf_params (qis.perfstats.config.PerfParams) – performance parameters of the statistics; None uses PERF_PARAMS, PerfParams(freq='ME'): monthly volatility and regression sampling

  • benchmark_description (str) – optional label of the principal portfolio

Parameters:
__init__(overlay_navs, principal_nav=None, regime_classifier=None, perf_params=None, benchmark_description=None)
Parameters:
Return type:

None

Methods

__init__(overlay_navs[, principal_nav, ...])

compute_smart_diversification_curve(...[, ...])

Two statistics of the eleven principal-overlay mixes of one overlay.

get_overlay_points(principal_nav[, x_var, y_var])

Two statistics of the principal portfolio and of each standalone overlay.

plot_conditional_sharpes([principal_nav, ...])

Regime-conditional bars of the principal and overlays, by qis.plot_regime_data.

plot_corr_matrix([var_format, freq, ax])

Correlation table of the overlay returns.

plot_nav([var_format, sharpe_format, ...])

Navs of the overlays, rebased to one, optionally with the principal portfolio.

plot_ra_table([time_period, desc_map, ...])

Table of the performance statistics of the principal portfolio and the overlays.

plot_returns_scatter([principal_nav, ...])

Quarterly returns of each overlay against the principal portfolio.

plot_smart_diversification_curve([...])

One curve per overlay through its eleven principal-overlay mixes.

plot_smart_diversification_scatter([...])

One point per standalone overlay and the principal, with a cross-sectional fit.

Attributes

overlay_navs: DataFrame
principal_nav: Series = None
regime_classifier: BenchmarkReturnsQuantilesRegime = None
perf_params: PerfParams = None
benchmark_description: str = None
compute_smart_diversification_curve(principal_nav, overlay_nav, principal_weight=1.0, max_overlay_weight=1.0, rebalancing_freq='QE', is_principal_weight_fixed=True, x_var=PerfStat.Bear - Sharpe, y_var=PerfStat.Sharpe(rf=0))[source]

Two statistics of the eleven principal-overlay mixes of one overlay.

The first mix holds no overlay, so the first row is the principal portfolio; each mix is classified against that first mix.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio

  • overlay_nav (Series) – nav of the overlay

  • principal_weight (float) – weight of the principal portfolio in every mix

  • max_overlay_weight (float) – overlay weight of the last mix

  • rebalancing_freq (str) – rebalancing frequency of the mixes

  • is_principal_weight_fixed (bool) – keep principal_weight fixed and add the overlay on top; False funds the overlay from the principal, with weights 1 - w and w

  • x_var (PerfStat) – statistic of the first column

  • y_var (PerfStat) – statistic of the second column

Returns:

one row per mix and the columns of x_var and y_var

Return type:

DataFrame

get_overlay_points(principal_nav, x_var=PerfStat.Bear - Sharpe, y_var=PerfStat.Sharpe(rf=0))[source]

Two statistics of the principal portfolio and of each standalone overlay.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio, the regime benchmark

  • x_var (PerfStat) – statistic of the first column

  • y_var (PerfStat) – statistic of the second column

Returns:

one row for the principal and one per overlay, with the columns of x_var and y_var

Return type:

DataFrame

plot_nav(var_format='{:.0%}', sharpe_format='{:.2f}', principal_nav=None, is_include_principal=False, title=None, is_log=True, ax=None, **kwargs)[source]

Navs of the overlays, rebased to one, optionally with the principal portfolio.

Parameters:
  • var_format (str) – format of the p.a. returns in the legend

  • sharpe_format (str) – format of the Sharpe ratios in the legend

  • principal_nav (Series) – nav of the principal portfolio; None uses the report’s

  • is_include_principal (bool) – also draw the principal portfolio

  • title (str) – figure title

  • is_log (bool) – logarithmic y axis

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to qis.plot_prices

Returns:

the figure, the one of ax when given

Return type:

Figure

plot_ra_table(time_period=None, desc_map=None, ticker_map=None, perf_columns=(PerfStat.P.a. return, PerfStat.Vol, PerfStat.Sharpe (rf=0), PerfStat.Bear-Sharpe, PerfStat.Normal-Sharpe, PerfStat.Bull-Sharpe, PerfStat.Max DD, PerfStat.Max DD/Vol, PerfStat.Skewness), columns_title='Assets', ax=None, **kwargs)[source]

Table of the performance statistics of the principal portfolio and the overlays.

Parameters:
  • time_period (TimePeriod) – sample of the statistics; None uses the full history

  • desc_map (Dict[str, str]) – optional names by column, shown in a Name column

  • ticker_map (Dict[str, str]) – optional tickers by column, shown in a ticker column

  • perf_columns (List[PerfStat]) – statistics of the table, in order

  • columns_title (str) – header of the first column

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to the statistic formats and to qis.plot_df_table

Returns:

the figure, the one of ax when given

Return type:

Figure

plot_conditional_sharpes(principal_nav=None, overlay_navs=None, regime_data_to_plot=RegimeData.REGIME_SHARPE, var_format='{:.2f}', is_names_to_2lines=False, title=None, ax=None, **kwargs)[source]

Regime-conditional bars of the principal and overlays, by qis.plot_regime_data.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio, the regime benchmark; None uses the report’s

  • overlay_navs (DataFrame) – navs of the overlays; None uses the report’s

  • regime_data_to_plot (RegimeData) – statistic of the bars

  • var_format (str) – format of the bar values

  • is_names_to_2lines (bool) – break the names at spaces and before +

  • title (str) – figure title

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to qis.plot_regime_data

Returns:

the figure, the one of ax when given

Return type:

Figure

plot_corr_matrix(var_format='{:.0%}', freq=None, ax=None, **kwargs)[source]

Correlation table of the overlay returns.

Parameters:
  • var_format (str) – format of the correlations

  • freq (str | None) – sampling frequency of the returns

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to qis.plot_returns_corr_table

Returns:

the new figure, or None when ax is given

Return type:

Figure

plot_smart_diversification_curve(principal_nav=None, principal_weight=1.0, is_principal_weight_fixed=True, rebalancing_freq='QE', x_var=PerfStat.Bear - Sharpe, y_var=PerfStat.Sharpe(rf=0), xlabel=None, ylabel=None, title=None, constraints=None, shifts=None, shifts_n=None, with_filter=None, x_limits=None, y_limits=None, ax=None, **kwargs)[source]

One curve per overlay through its eleven principal-overlay mixes.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio; None uses the report’s

  • principal_weight (float) – weight of the principal portfolio in every mix

  • is_principal_weight_fixed (bool) – see compute_smart_diversification_curve

  • rebalancing_freq (str) – rebalancing frequency of the mixes

  • x_var (PerfStat) – statistic of the x axis

  • y_var (PerfStat) – statistic of the y axis, different from x_var

  • xlabel (str) – x-axis label; None uses the statistic name

  • ylabel (str) – y-axis label; None uses the statistic name

  • title (str) – figure title

  • constraints (Dict[str, float]) – optional maximum overlay weight by overlay, 1.0 otherwise

  • shifts (Dict[str, bool]) – optional label placement by name, True above and False below

  • shifts_n (Dict[str, float]) – overlays whose end label gets a line break

  • with_filter (List[str]) – overlays whose curve is smoothed by a cubic fit

  • x_limits (Tuple[float | None, float | None]) – x-axis limits

  • y_limits (Tuple[float | None, float | None]) – y-axis limits

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to the statistic formats and to qis.plot_lines_list

Returns:

the figure, the one of ax when given

Raises:

ValueError – if x_var and y_var are the same statistic

Return type:

Figure

plot_smart_diversification_scatter(principal_nav=None, is_drop_principal=False, x_var=PerfStat.Bear - Sharpe, y_var=PerfStat.Sharpe(rf=0), xvar_format='{:.1f}', yvar_format='{:.1f}', shifts=None, xlabel=True, ylabel=True, is_add_model_equation=True, annotation_labels=None, portfolio_curve=None, ci=95, ax=None, **kwargs)[source]

One point per standalone overlay and the principal, with a cross-sectional fit.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio; None uses the report’s

  • is_drop_principal (bool) – leave the principal portfolio out

  • x_var (PerfStat) – statistic of the x axis

  • y_var (PerfStat) – statistic of the y axis

  • xvar_format (str) – format of the x values

  • yvar_format (str) – format of the y values

  • shifts (Dict[str, bool]) – optional label placement by name, True above and False below

  • xlabel (str | bool | None) – x-axis label; True uses the statistic name

  • ylabel (str | bool | None) – y-axis label; True uses the statistic name

  • is_add_model_equation (bool) – show the equation of the fit

  • annotation_labels (List[str]) – point labels; None uses the names

  • portfolio_curve (List[str]) – names of points joined by a quadratic fit

  • ci (int) – confidence level of the fit band, in percent

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to qis.plot_scatter

Returns:

the figure, the one of ax when given

Return type:

Figure

plot_returns_scatter(principal_nav=None, overlay_navs=None, add_45line=False, title=None, ax=None, **kwargs)[source]

Quarterly returns of each overlay against the principal portfolio.

Parameters:
  • principal_nav (Series) – nav of the principal portfolio; None uses the report’s

  • overlay_navs (DataFrame) – navs of the overlays; None uses the report’s

  • add_45line (bool) – draw the 45-degree line

  • title (str | None) – figure title

  • ax (Axes) – axis to draw on; None creates a figure

  • **kwargs – passed to qis.plot_returns_scatter

Returns:

the figure, the one of ax when given

Return type:

Figure