bayesline.api.equity.AsyncPortfolioHoldingsReportAccessor#

class bayesline.api.equity.AsyncPortfolioHoldingsReportAccessor(accessor: AsyncReportAccessorApi)#

Specific accessor for a portfolio holdings report.

abstract __init__(accessor: AsyncReportAccessorApi)#

Methods

__init__(accessor)

holdings()

Return the public long-format holdings projection.

tearsheet(*[, asset_id, start_date, ...])

Return the holdings tearsheet for an asset.

with_scenario(scenario_settings)

Return a new accessor with the given scenario settings applied.

Attributes

accessor

The underlying report accessor API.

scenario_types

scenario_types: ClassVar[list[type[AnyScenarioSettings]]] = [<class 'bayesline.api._src.equity.report.scenarios.PortfolioHoldingsScenario'>]#
abstract async holdings() DataFrame#

Return the public long-format holdings projection.

Returns#

pl.DataFrame

The holdings projection.

abstract async tearsheet(*, asset_id: str | None = None, start_date: str | date | datetime | None = None, end_date: str | date | datetime | None = None, portfolio_path: Sequence[str] = (), history: bool | Sequence[Literal['nav', 'share_qty', 'weight', 'active_weight']] = False) PortfolioHoldingsAssetTearsheet#

Return the holdings tearsheet for an asset.

Includes the asset name, input asset ID, and input asset ID type along with relevant all metrics over the given date range.

Parameters#

asset_idstr | None, default=None

The ID of the asset. None rolls the metrics up across every asset the portfolio holds, in which case the tearsheet’s subject is that portfolio rather than an asset.

start_dateDateLike | None, default=None

The start date of the tearsheet.

end_dateDateLike | None, default=None

The end date of the tearsheet.

portfolio_pathSequence[str], default=()

The portfolio holding the asset, given as a list to account for fund-of-funds structures. Empty takes the asset across the whole report, which for a report spanning several portfolios aggregates over all of them.

historybool | Sequence[PortfolioHoldingsMetric], default=False

Which metrics to return the full history of: none of them (False), all of them (True), or the named ones. A metric without history is returned as its latest value alone.

Returns#

PortfolioHoldingsAssetTearsheet

The holdings tearsheet.

Raises#

IllegalPathError

If the report has no portfolio or asset axis to address, or does not carry holdings metrics.

AssetNotHeldError

If the portfolio holds nothing, or not the asset, in the date range.

ValueError

If history names a metric the tearsheet does not carry.