bayesline.api.equity.AsyncPortfolioReturnsReportAccessorImpl#
- class bayesline.api.equity.AsyncPortfolioReturnsReportAccessorImpl(accessor: AsyncReportAccessorApi)#
- __init__(accessor: AsyncReportAccessorApi)#
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
The underlying report accessor API.
scenario_types- __init__(accessor: AsyncReportAccessorApi)#
- property accessor: AsyncReportAccessorApi#
The underlying report accessor API.
Returns#
- AsyncReportAccessorApi
The underlying report accessor API.
- async 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_nameslist[str] | None, default=None
The names of the portfolios to calculate the report for. If None, all portfolios will be calculated.
- start_dateDateLike | None, default=None
The start date of the report.
- end_dateDateLike | None, default=None
The end date of the report.
- aggregation_typeLiteral[“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_colslist[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.
- async 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_idstr
The id of the portfolio to calculate the report for.
- start_dateDateLike | None, default=None
The start date of the report.
- end_dateDateLike | None, default=None
The end date of the report.
- aggregation_typeLiteral[“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_colslist[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.