Visualizers#
Plotly chart-creation functions consumed by the dashboard, built from PyArrow tables.
Attribution visualization module — Plotly charts using PyArrow tables.
Provides chart-creation functions that return Plotly Figure objects for use in the Dash dashboard, without any pandas dependency. All data extraction uses pa.Table / pyarrow.compute and plain Python lists.
- create_brinson_fachler_chart(brinson_fachler_indexes: Table, date_column: str = 'date') Figure[source]#
Create the 3-panel Brinson-Fachler attribution chart.
- Panels:
Strategy vs Benchmark Returns
Cumulative Alpha
Allocation, Selection, Interaction Effects
- create_decomposition_bar_chart(total_pct: dict) Figure[source]#
Create a horizontal bar chart of end-of-period factor contributions.
- Parameters:
total_pct (dict) – {factor_name: contribution_fraction} — e.g. from FactorModelArrowAttribution.cumulative_pct_decomp(). The residual key
idio_returnsis labelled “Idiosyncratic” and the return componentsf_carry/f_dividends“Carry” / “Dividends”.
- create_drawdown_chart(portfolio_returns: Table, date_column: str = 'date', value_column: str = 'portfolio_returns') Figure[source]#
Create drawdown analysis chart.
Computes cumulative returns, running max, and drawdown entirely with Python lists (no pandas).
- create_factor_attribution_chart(simulated_rets: Table, date_column: str = 'date', cumulative_totals: Table | None = None) Figure[source]#
Create the 3-panel factor attribution line chart.
- Parameters:
simulated_rets (pa.Table) – Cumulative contribution per factor (
FactorModelArrowAttribution.simulated_rets).date_column (str, default "date") – Name of the date column in both tables.
cumulative_totals (pa.Table or None, default None) –
FactorModelArrowAttribution.cumulative_totals(). Drawn in panel 1 asPortfolio/Factors/Idiosyncratic(plusCarry/Dividendswhen present, which panel 1’s title then names); panel 1 is empty when None.
- Returns:
Panels: (1) the model’s cumulative portfolio / factor / idiosyncratic return, plus carry / dividends when supplied, (2) style and other factors (every factor that is neither an aggregate, a return component nor an industry), (3) industry factors with a non-zero value. Aggregate files (
AGGREGATE_FACTOR_COLUMNS) are never drawn.- Return type:
go.Figure
- create_factor_attribution_summary_chart(cumulative_totals: Table, date_column: str = 'date') Figure[source]#
Create the compact headline chart of the model’s cumulative totals.
- Parameters:
cumulative_totals (pa.Table) –
FactorModelArrowAttribution.cumulative_totals(): columnsportfolio_returns,factor_returns,idiosyncratic_returns, optionallycarry_returns/dividends_returns.date_column (str, default "date") – Name of the date column.
- Returns:
Lines named
Portfolio,FactorsandIdiosyncratic, plusCarryandDividendswhen the totals have those columns.- Return type:
go.Figure
- create_returns_distribution(portfolio_returns: Table, date_column: str = 'date', value_column: str = 'portfolio_returns') Figure[source]#
Create returns distribution analysis (histogram + time series).
- create_stacked_decomposition_chart(pct_df_returns: Table, date_column: str = 'date', days_of_smoothing: int = 45) Figure[source]#
Create a normalized stacked area chart of factor return decomposition.
Each factor’s share = abs(factor) / sum(abs(all factors)), always sums to 100%, smoothed with a trailing
days_of_smoothingmean that uses a partial window at the start, so the chart begins at the first date. The residual columnf_idio_returnsis labelled “Idiosyncratic” and the return componentsf_carry/f_dividends“Carry” / “Dividends”. Implemented with pure pyarrow + Python lists (no pandas).