bayesline.api.equity.PortfolioReturnsReportAccessorImpl#

class bayesline.api.equity.PortfolioReturnsReportAccessorImpl(accessor: ReportAccessorApi)#
__init__(accessor: ReportAccessorApi)#

Methods

__init__(accessor)

get_asset_returns(portfolio_id[, ...])

Get the asset level returns for the portfolio id between start and end dates.

get_portolio_returns([portfolio_names, ...])

Get the portfolio returns for the portfolio names between start and end dates.

with_scenario(scenario_settings)

Return a new accessor with the given scenario settings applied.

Attributes

accessor

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.

get_portolio_returns(portfolio_names: list[str] | None = None, start_date: str | date | datetime | None = None, end_date: str | date | datetime | None = None, aggregation_type: Literal['D', 'M', 'Y'] | None = 'D', value_cols: list[str] | None = None) DataFrame#

Get the portfolio returns for the portfolio names between start and end dates.

Parameters#

portfolio_names: list[str] | None, default=None

The names of the portfolios to calculate the report for. If None, all portfolios will be calculated.

start_date: DateLike | None, default=None

The start date of the report.

end_date: DateLike | None, default=None

The end date of the report.

aggregation_type: Literal[“D”, “M”, “Y”] | None, default=”D”

The aggregation type to use for the returns. If None, dates will be completely collapsed and the returns for the entire period will be returned.

value_cols: list[str] | None, default=None

The value columns to return. If None, all value columns will be returned.

Returns#

pl.DataFrame

A dataframe with the portfolio returns.

get_asset_returns(portfolio_id: str, start_date: str | date | datetime | None = None, end_date: str | date | datetime | None = None, aggregation_type: Literal['D', 'M', 'Y'] | None = 'D', value_cols: list[str] | None = None) DataFrame#

Get the asset level returns for the portfolio id between start and end dates.

Parameters#

portfolio_id: str

The id of the portfolio to calculate the report for.

start_date: DateLike | None, default=None

The start date of the report.

end_date: DateLike | None, default=None

The end date of the report.

aggregation_type: Literal[“D”, “M”, “Y”] | None, default=”D”

The aggregation type to use for the returns. If None, dates will be completely collapsed and the returns for the entire period will be returned.

value_cols: list[str] | None, default=None

The value columns to return. If None, all value columns will be returned.

Returns#

pl.DataFrame

A dataframe with the asset level returns.