bayesline.api.equity.AsyncReportAccessorApi#
- class bayesline.api.equity.AsyncReportAccessorApi#
Abstract base class for report accessor APIs.
This class extends BaseReportAccessorApi with additional abstract methods for getting level values and data from portfolio reports.
- __init__()#
Methods
__init__()get_data(path, *[, expand, pivot_cols, ...])Get data for the specified path.
get_data_as_task(path, *[, expand, ...])get_level_values([levels, include_totals, ...])Get level values for the specified levels.
is_path_valid(path_levels, *[, expand])Check if a path is valid.
persist(name)Persist the given report for the given name.
validate_path(path_levels[, expand])Validate a path and expand tuple.
Attributes
axesGet the axes configuration for the report.
axis_lookupGet the axis lookup mapping.
metric_colsGet the metric column names for the report.
pivot_colsGet the pivot column names for the report.
- abstract async get_level_values(levels: tuple[str, ...] = (), include_totals: bool = False, filters: list[tuple[str, str, Any] | Sequence[tuple[str, str, Any]]] | None = None) DataFrame#
Get level values for the specified levels.
Parameters#
- levelstuple[str, …], default=()
The levels to get values for.
- include_totalsbool, default=False
Whether to include totals in the results.
- filtersDNFFilterExpressions | None, default=None
Optional filters to apply.
Returns#
- pl.DataFrame
A DataFrame containing the level values.
- abstract async get_data(path: list[tuple[str, str]], *, expand: tuple[str, ...] = (), pivot_cols: tuple[str, ...] = (), value_cols: tuple[str, ...] = (), filters: list[tuple[str, str, Any] | Sequence[tuple[str, str, Any]]] | None = None, pivot_total: bool = False) DataFrame#
Get data for the specified path.
Parameters#
- pathlist[tuple[str, str]]
The path to get data for.
- expandtuple[str, …], default=()
The expand tuple for the path.
- pivot_colstuple[str, …], default=()
The columns to pivot on.
- value_colstuple[str, …], default=()
The value columns.
- filtersDNFFilterExpressions | None, default=None
Optional filters to apply.
- pivot_totalbool, default=False
Whether to include pivot totals.
Returns#
- pl.DataFrame
A DataFrame containing the requested data.