Cross-sectional aggregation
Most signals in the Exabel platform are evaluated for entities, and produce one or more time series for each entity. With the cross-sectional aggregation it is possible to aggregate signals across a universe of entities.
- cross_section(signal, method, universe=None)
Perform a cross-sectional analysis of a signal across a universe. Depending on the method, the signal may return one time series, or one time series per entity.
- Parameters:
signal (Signal) – the signal to perform the cross-sectional analysis on.
method (str) – the cross-sectional method; one of
sum
,median
,mean
,proportion
,rank_ascending
orrank_descending
.universe (str|list[str]|None) – the optional entity universe, specified as an entity resource name, a tag resource name, or a list of those.
The universe can have a maximum of 1000 entities.
If a universe is not given, the signal is aggregated across all the evaluation entities, for example the list of entities given in Plotter.
When the method is one of rank_ascending
, rank_descending
or proportion
, one time series
is returned for each evaluation entity. The signal can then only be evaluated for entities which are
also in the cross-sectional universe.
Examples:
Calculate the sum of the close price across a tag:
cross_section(Close_Price, "sum", "tags/user:abcdefg-1234-1234-1234-aabbccddee")
Calculate the average of FactSet sales of two companies:
cross_section(fs_actual('sales'), "mean",
["entityTypes/company/entities/F-ASDF-F", "entityTypes/company/entities/F-TROT-F"])
Calculate the average close price across the evaluation entities:
cross_section(Close_Price, "sum")