bayesline.api.equity.AsyncUploadParserApi#

class bayesline.api.equity.AsyncUploadParserApi#

Bases: ABC

Methods

__init__()

can_handle(raw_df, *[, name])

Parameters raw_df: pl.DataFrame The dataframe to check if the parser can handle. name: str | None, optional The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.

get_examples()

Returns list[pl.DataFrame]: A list of example portfolios that can be used to test the parser.

output_schema()

Returns dict[str, pl.DataType]: The schema that this parser produces.

parse(raw_df, *[, name])

Parameters raw_df: pl.DataFrame The dataframe to parse. name: str | None, optional The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.

Attributes

abstract property name: str#
abstract async output_schema() dict[str, DataType]#

Returns#

dict[str, pl.DataType]:

The schema that this parser produces.

abstract async get_examples() list[DataFrame]#

Returns#

list[pl.DataFrame]:

A list of example portfolios that can be used to test the parser.

abstract async can_handle(raw_df: DataFrame, *, name: str | None = None) UploadParserResult#

Parameters#

raw_df: pl.DataFrame

The dataframe to check if the parser can handle.

name: str | None, optional

The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.

Returns#

UploadParserResult

abstract async parse(raw_df: DataFrame, *, name: str | None = None) tuple[DataFrame, UploadParserResult]#

Parameters#

raw_df: pl.DataFrame

The dataframe to parse.

name: str | None, optional

The name of the dataframe (which could be the filename). Some parsers might extract information (such as a date) from the name.

Returns#

tuple[pl.DataFrame, UploadParserResult]:

A tuple of the parsed pl.DataFrame and a UploadParserResult. If the parser was unsuccessful the parsed dataframe will instead be a (possibly empty) error dataframe.