quantlab.analysis.factor_report.PairAnalysis#

class quantlab.analysis.factor_report.PairAnalysis(factor_name, fret_name, horizon, quantiles, ic, pearson_ic, monthly_ic, quantile_returns, mean_quantile_returns, spread, cumulative_quantile_returns, cumulative_long_short, turnover, rank_autocorrelation, rank_autocorrelations, summary=<factory>)[source]#

Bases: object

Metrics of one factor variable against one forward-return variable.

Every time series is indexed by timestamp; bucket columns are the integers 1..quantiles, bucket 1 holding the lowest factor values.

Attributes:
factor_name, fret_namestr

The analyzed factor variable and forward-return variable.

horizonint

Bars the forward return spans; cumulative returns compound the per-bar rate (1 + r) ** (1 / horizon) - 1.

quantilesint

Number of buckets.

icpandas.Series

Per-period Spearman (rank) IC.

pearson_icpandas.Series

Per-period Pearson IC, on the same cells as ic. A large gap between the two means a few extreme values drive the linear one.

monthly_icpandas.Series

Mean IC per calendar month, indexed by month end.

quantile_returnspandas.DataFrame

Mean forward return per bucket and period.

mean_quantile_returnspandas.Series

Time mean of quantile_returns per bucket.

spreadpandas.Series

Top-bucket minus bottom-bucket mean forward return per period.

cumulative_quantile_returnspandas.DataFrame

Compounded per-bar return of each bucket.

cumulative_long_shortpandas.Series

Compounded per-bar return of long the top bucket, short the bottom.

turnoverpandas.DataFrame

Fraction of each bucket’s symbols that were not in it the period before.

rank_autocorrelationpandas.Series

Spearman correlation of the factor with its value one period earlier.

rank_autocorrelationspandas.DataFrame

The same at every lag of FactorAnalyzer.autocorrelation_lags, one column per lag; column 1 is rank_autocorrelation.

cumulative_icpandas.Series

Running sum of the per-period IC, periods without an IC adding 0.

summarydict

The scalar metrics; one row of FactorAnalysis.summary_table().

property cumulative_ic#

Running sum of the per-period IC, periods without an IC adding 0.

Examples

>>> pair.cumulative_ic.iloc[-1] == pair.ic.fillna(0).sum()
True
property end#

Last timestamp of the aligned panel.

Examples

>>> pair.end
Timestamp('2024-04-09 00:00:00')
property key#

"<factor>__<fret>", the pair’s name in files and dicts.

Examples

>>> pair.key
'signal__ret_1'
property start#

First timestamp of the aligned panel.

Examples

>>> pair.start
Timestamp('2024-01-01 00:00:00')