bayesline.api.equity.AsyncExposureApi#

class bayesline.api.equity.AsyncExposureApi#

Bases: ABC

Methods

__init__()

coverage_stats(universe, *[, id_type, by])

Parameters universe: str | int | UniverseSettings | AsyncUniverseApi The universe to use for the exposure calculation. id_type: IdType, optional The id type to return asset ids in, e.g. ticker. The given id type must be supported by the linked universe. by: str, optional The aggregation, either by date or by asset

coverage_stats_as_task(universe, *[, ...])

dates(universe, *[, range_only])

Parameters universe: str | int | UniverseSettings | UniverseApi The universe to use for the exposure calculation. range_only: bool, optional If True, returns the first and last date only.

get(universe, *[, start, end, id_type, ...])

Parameters universe: str | int | UniverseSettings | AsyncUniverseApi The universe to use for the exposure calculation. start: DateLike, optional The start date of the universe to return, inclusive. end: DateLike, optional The end date of the data to return, inclusive. id_type: IdType, optional The id type to return asset ids in, e.g. ticker. The given id type must be supported by the linked universe. filter_tradedays: bool, default=False If True, only returns data for tradedays.

get_as_task(universe, *[, start, end, ...])

Attributes

settings

Returns The settings used to create these exposures.

abstract property settings: ExposureSettings#

Returns#

The settings used to create these exposures.

abstract async dates(universe: str | int | UniverseSettings | AsyncUniverseApi, *, range_only: bool = False) list[date]#

Parameters#

universe: str | int | UniverseSettings | UniverseApi

The universe to use for the exposure calculation.

range_only: bool, optional

If True, returns the first and last date only.

Returns#

list of all covered dates.

abstract async coverage_stats(universe: str | int | UniverseSettings | AsyncUniverseApi, *, id_type: Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name'] | None = None, by: Literal['date', 'asset'] = 'date') DataFrame#

Parameters#

universe: str | int | UniverseSettings | AsyncUniverseApi

The universe to use for the exposure calculation.

id_type: IdType, optional

The id type to return asset ids in, e.g. ticker. The given id type must be supported by the linked universe.

by: str, optional

The aggregation, either by date or by asset

Returns#

pl.DataFrame

A dataframe with date as the first column, where the remaining columns names are the styles and substyles (concatenated with a dot). The values are the counts of the underlying data before it was imputed.

abstract async coverage_stats_as_task(universe: str | int | UniverseSettings | AsyncUniverseApi, *, id_type: Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name'] | None = None, by: Literal['date', 'asset'] = 'date') AsyncTask[DataFrame]#
abstract async get(universe: str | int | UniverseSettings | AsyncUniverseApi, *, start: str | date | datetime | None = None, end: str | date | datetime | None = None, id_type: Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name'] | None = None, filter_tradedays: bool = False) DataFrame#

Parameters#

universe: str | int | UniverseSettings | AsyncUniverseApi

The universe to use for the exposure calculation.

start: DateLike, optional

The start date of the universe to return, inclusive.

end: DateLike, optional

The end date of the data to return, inclusive.

id_type: IdType, optional

The id type to return asset ids in, e.g. ticker. The given id type must be supported by the linked universe.

filter_tradedays: bool, default=False

If True, only returns data for tradedays.

Raises#

ValueError

If the given id type is not supported or date range is invalid.

Returns#

pl.DataFrame

The data for the given date range with a where the date is the first column and the asset id is the second column. The remaining columns are the individual styles.

abstract async get_as_task(universe: str | int | UniverseSettings | AsyncUniverseApi, *, start: str | date | datetime | None = None, end: str | date | datetime | None = None, id_type: Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name'] | None = None, filter_tradedays: bool = False) AsyncTask[DataFrame]#