bayesline.api.equity.AsyncPortfolioReturnsReportApi#

class bayesline.api.equity.AsyncPortfolioReturnsReportApi#

API for a portfolio returns report.

__init__()#

Methods

__init__()

calculate(portfolio_names, start_date, ...)

Calculate the portfolio returns report.

calculate_as_task(portfolio_names, ...)

Calculate the portfolio returns report as a task.

get_maybe_cached(portfolio_names, ...)

Get the cached portfolio returns report accessor API if it is available.

to_mermaid()

Get a Mermaid diagram of the report execution graph.

Attributes

settings

The settings used to create this report.

abstract async get_maybe_cached(portfolio_names: list[str] | None, start_date: str | date | datetime | None, end_date: str | date | datetime | None, **kwargs: Any) AsyncPortfolioReturnsReportAccessor | None#

Get the cached portfolio returns report accessor API if it is available.

Parameters#

portfolio_nameslist[str] | None

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

start_dateDateLike | None

The start date of the report.

end_dateDateLike | None

The end date of the report.

**kwargs: Any

Additional keyword arguments.

Returns#

AsyncPortfolioReturnsReportAccessor | None

The cached portfolio returns report accessor API, or None if the report is not cached.

abstract async calculate(portfolio_names: list[str] | None, start_date: str | date | datetime | None, end_date: str | date | datetime | None, **kwargs: Any) AsyncPortfolioReturnsReportAccessor#

Calculate the portfolio returns report.

Parameters#

portfolio_nameslist[str] | None

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

start_dateDateLike | None

The start date of the report.

end_dateDateLike | None

The end date of the report.

**kwargs: Any

Additional keyword arguments.

Returns#

AsyncPortfolioReturnsReportAccessor

The portfolio returns report accessor.

abstract async calculate_as_task(portfolio_names: list[str] | None, start_date: str | date | datetime | None, end_date: str | date | datetime | None, **kwargs: Any) AsyncTask[AsyncPortfolioReturnsReportAccessor]#

Calculate the portfolio returns report as a task.

Parameters#

portfolio_nameslist[str] | None

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

start_dateDateLike | None

The start date of the report.

end_dateDateLike | None

The end date of the report.

**kwargs: Any

Additional keyword arguments.

Returns#

AsyncTask[PortfolioReturnsReportAccessor]

The task for the portfolio returns report accessor.