quantlab.runs.factor_attribution_report#

The Factor attribution section of a backtest’s report page.

factor_attribution_section draws a run’s factor attribution from its metrics block (quantlab.risk.attribution.attribution_summary per segment) and its per-bar store (factor_attribution.zarr) only: this module imports no risk model. It reads, on the store’s factor axis, each factor’s group (country, industry, style) and display label (the factor name when the store has none).

The section opens with six tiles (annualized log growth, the part from the factors, risk-free plus trading, forecast and realized volatility, coverage) and then sets return and risk side by side, row by row: by part (bars from the zero axis), over time, the styles and the industries; the styles’ exposure over time and each part’s return against its realized risk close it. Every tile and chart carries a plain-English explanation in its title, which the page shows on hover.

Examples#

>>> html = factor_attribution_section(
...     metrics["factor_attribution"], run.factor_attribution(), out_of_sample=False
... )
>>> "Return by part" in html
True

Functions

factor_attribution_section

Return the Factor attribution section's html: tiles, then return and risk side by side.