Core#
Attribution Dashboard — Main orchestrator class.
Coordinates all dashboard components, layouts, callbacks, and visualizations. Follows the same pattern as kaxanuk.backtest_engine.dashboard.backtest_dashboard.
- class AttributionDashboard(attribution_results: AttributionResultDict, portfolio_name: str | None = None, benchmark_name: str | None = None, logo_path: str | None = None, days_of_smoothing: int = 45, date_column: str = 'date')[source]#
Bases:
objectInteractive Dash-based dashboard for attribution analysis.
Metrics are pre-calculated by the engine and passed in rather than computed inside the dashboard.
- Parameters:
attribution_results (AttributionResultDict) – Pre-calculated attribution results to display.
portfolio_name (str or None, default None) – Display name of the portfolio, shown in the dashboard header.
benchmark_name (str or None, default None) – Display name of the benchmark.
logo_path (str or None, default None) – Path to a logo image file to embed in the dashboard header.
days_of_smoothing (int, default 45) – Number of days used for smoothing in relevant chart components.
date_column (str, default "date") – Name of the date column shared across the attribution result tables.
- results#
The raw attribution results passed to the constructor.
- Type:
- date_column#
Name of the date column shared across the attribution result tables.
- Type:
str
- portfolio_returns#
Columns:
[date, portfolio_returns].- Type:
pyarrow.Table
- simulated_rets#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- portfolio_attribution_ts#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- pct_df_returns#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- total_pct_decomposition#
Mapping of
{factor_name: contribution_fraction}.- Type:
dict
- summary_stats#
Mapping of
{metric_name: value}.- Type:
dict
- brinson_fachler_indexes#
Brinson-Fachler attribution index table, if computed.
- Type:
pyarrow.Table or None
- portfolio_name#
Display name of the portfolio.
- Type:
str or None
- benchmark_name#
Display name of the benchmark.
- Type:
str or None
- logo_path#
Path to the logo image file, if any.
- Type:
str or None
- days_of_smoothing#
Number of days used for smoothing in relevant chart components.
- Type:
int
- app#
The underlying Dash application instance.
- Type:
dash.Dash
- class AttributionResultDict[source]#
Bases:
TypedDictPre-calculated attribution results consumed by
AttributionDashboard.- portfolio_returns#
Columns:
[date, portfolio_returns].- Type:
pyarrow.Table
- simulated_rets#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- portfolio_attribution_ts#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- pct_df_returns#
Columns:
[date, factor1, factor2, ...].- Type:
pyarrow.Table
- total_pct_decomposition#
Mapping of
{factor_name: contribution_fraction}.- Type:
dict
- summary_stats#
Mapping of
{metric_name: value}.- Type:
dict
- brinson_fachler_indexes#
Brinson-Fachler attribution index table, if computed.
- Type:
pyarrow.Table or None
- portfolio_name#
Display name of the portfolio.
- Type:
str
- benchmark_name#
Display name of the benchmark.
- Type:
str
- benchmark_name: str#
- brinson_fachler_indexes: Table | None#
- pct_df_returns: Table#
- portfolio_attribution_ts: Table#
- portfolio_name: str#
- portfolio_returns: Table#
- simulated_rets: Table#
- summary_stats: dict#
- total_pct_decomposition: dict#
- create_dashboard_from_attribution(attribution_results: AttributionResultDict, portfolio_name: str | None = None, benchmark_name: str | None = None, logo_path: str | None = None, days_of_smoothing: int = 45, date_column: str = 'date') AttributionDashboard[source]#
Create an
AttributionDashboardfrom pre-calculated results.- Parameters:
attribution_results (AttributionResultDict) – Pre-calculated attribution results to display.
portfolio_name (str or None, default None) – Display name of the portfolio, shown in the dashboard header.
benchmark_name (str or None, default None) – Display name of the benchmark.
logo_path (str or None, default None) – Path to a logo image file to embed in the dashboard header.
days_of_smoothing (int, default 45) – Number of days used for smoothing in relevant chart components.
date_column (str, default "date") – Name of the date column shared across the attribution result tables.
- Returns:
A dashboard instance configured with the given results and options, ready to be served with
AttributionDashboard.run_server().- Return type: