bayesline.api.equity.PortfolioApi.get_coverage

bayesline.api.equity.PortfolioApi.get_coverage#

abstract PortfolioApi.get_coverage(names: str | list[str] | None = None, *, by: Literal['date', 'asset'] = 'date', metric: Literal['count', 'holding'] = 'count', stats: list[str] | None = None) DataFrame#

Parameters#

names: str | list[str], optional

The names of the portfolios. If not given all portfolios will be calculated.

by: str, optional

The coverage aggregation, either by date or by asset.

metric: str, optional

The metric to calculate, either count of observations or sum of holding values.

stats: list[str], optional

list of ‘min’, ‘max’, ‘mean’, collapses by into these stats.

Returns#

pl.DataFrame:

The dated coverage count for each id type. portfolio_group and portfolio are the first two columns. If stats given, collapses the by index to the given aggregations.