bayesline.api.equity.PortfolioHierarchyApi#

class bayesline.api.equity.PortfolioHierarchyApi#

Bases: ABC

Methods

__init__()

get(start_date, end_date[, id_type])

get_dates(*[, collapse])

Parameters collapse: bool, optional If True, will calculate aggregations any and all, indicating of for a given date, any (or all) portfolios have holdings.

get_id_types()

Returns dict[str, list[IdType]]: The available ID types that at least a portion of assets can be mapped to for each portfolio. If a portfolio has a benchmark then the available id types are those that are available for both the portfolio and the benchmark.

Attributes

settings

Returns The settings used to create this hierarchy.

abstract property settings: PortfolioHierarchySettings#

Returns#

The settings used to create this hierarchy.

abstract get_id_types() dict[str, list[Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name']]]#

Returns#

dict[str, list[IdType]]:

The available ID types that at least a portion of assets can be mapped to for each portfolio. If a portfolio has a benchmark then the available id types are those that are available for both the portfolio and the benchmark.

abstract get_dates(*, collapse: bool = False) dict[str, list[date]]#

Parameters#

collapse: bool, optional

If True, will calculate aggregations any and all, indicating of for a given date, any (or all) portfolios have holdings.

Returns#

A dict of portfolio-id to dates for which this hierarchy can be produced. For a given portfolio and date, the hierarchy can be produced if the portfolio has holdings for that date. If a benchmark is given then this benchmark also must have holdings for the given date.

abstract get(start_date: str | date | datetime | None, end_date: str | date | datetime | None, id_type: Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name'] | None = None) DataFrame#