bayesline.api.equity.PortfolioHoldingsReportAccessorImpl#
- class bayesline.api.equity.PortfolioHoldingsReportAccessorImpl(accessor: ReportAccessorApi)#
- __init__(accessor: ReportAccessorApi)#
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
The underlying report accessor API.
scenario_types- __init__(accessor: ReportAccessorApi)#
- property accessor: ReportAccessorApi#
The underlying report accessor API.
Returns#
- ReportAccessorApi
The underlying report accessor API.
- holdings() DataFrame#
Return the public long-format holdings projection.
Returns#
- pl.DataFrame
The holdings projection.
- 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_id: str | 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_date: DateLike | None, default=None
The start date of the tearsheet.
- end_date: DateLike | None, default=None
The end date of the tearsheet.
- portfolio_path: Sequence[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.
- history: bool | 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
historynames a metric the tearsheet does not carry.