quantlab.analysis.factor_report.FactorReportFigure#

class quantlab.analysis.factor_report.FactorReportFigure(rolling_window=22)[source]#

Bases: object

Draw one composite matplotlib figure of a PairAnalysis.

The figure is a grid of panels: the IC series with its rolling mean; the IC histogram with a fitted normal curve; a normal QQ plot of the IC; the monthly mean IC heatmap; mean forward return by bucket; cumulative return by bucket; the cumulative long-short return; bucket turnover; factor rank autocorrelation; and a table of the scalar metrics. The suptitle names the factor, the fret and the date range.

Parameters:
rolling_windowint, default 22

Window, in periods, of the rolling mean IC.

Examples

>>> fig = FactorReportFigure().render(pair)
>>> type(fig).__name__, len(fig.axes)
('Figure', 11)
>>> fig.savefig("signal__ret_1.png")
render(pair, decay=None)[source]#

Return the composite figure of pair.

The figure is built with matplotlib.figure.Figure rather than pyplot, so it is never shown and needs no closing.

Parameters:
pairPairAnalysis

The metrics to draw.

decaypandas.DataFrame, optional

The factor’s rows of FactorAnalysis.ic_decay_table(). With two or more rows the figure includes a panel of the mean IC by horizon, this pair’s fret highlighted.

Returns:
matplotlib.figure.Figure

The figure.

Examples

>>> fig = FactorReportFigure(rolling_window=10).render(pair)
>>> fig.get_suptitle()
'signal  vs  ret_1   |   2024-01-01 to 2024-04-09'