bayesline.api.equity.TypedReportAccessorApi#
- class bayesline.api.equity.TypedReportAccessorApi(accessor: ReportAccessorApi)#
A base interface for typed report accessor APIs.
It is meant to be extended by concrete report implementations, e.g. a FactorCovarianceReportAccessorApi which adds concrete functions that operate on the underyling low level report accessor and slice report data to specific representations, e.g. def fcov which returns the correct dataframe representation of the factor covariance matrix instead the raw report dataframe.
- abstractmethod __init__(accessor: ReportAccessorApi)#
Methods
__init__(accessor)with_scenario(scenario_settings, *[, name])Return a new accessor with the given scenario settings applied.
Attributes
The underlying report accessor API.
- scenario_types: ClassVar[list[type[Annotated[PortfolioHoldingsScenario | BasketFactorScenario, FieldInfo(annotation=NoneType, required=True, discriminator='type')]]]] = []#
- abstractmethod __init__(accessor: ReportAccessorApi)#
- abstract property accessor: ReportAccessorApi#
The underlying report accessor API.
Returns#
- ReportAccessorApi
The underlying report accessor API.
- with_scenario(scenario_settings: Annotated[PortfolioHoldingsScenario | BasketFactorScenario, FieldInfo(annotation=NoneType, required=True, discriminator='type')] | Sequence[Annotated[PortfolioHoldingsScenario | BasketFactorScenario, FieldInfo(annotation=NoneType, required=True, discriminator='type')]], *, name: str | None = None) Self#
Return a new accessor with the given scenario settings applied.
Parameters#
- scenario_settingsAnyScenarioSettings | Sequence[AnyScenarioSettings]
The scenario settings to apply.
- namestr | None, default=None
Keep the scenario under this name, scoped to this report. The call returns once the scenario is computed, and every later query of the returned accessor, in any session, reuses it. The same name with the same settings returns the same accessor at once; the same name with different settings replaces what the name held. Without a name the scenario is computed on the first query, and later queries with the same settings, in any session, reuse it.
Returns#
- Self
A new accessor with the scenario settings applied.
Raises#
- NotImplementedError
If this accessor does not support scenarios.