bayesline.api.equity.RiskDatasetLoaderApi#

class bayesline.api.equity.RiskDatasetLoaderApi#

API for loading and managing risk datasets.

This class provides functionality for loading, creating, and managing risk datasets through a registry-based approach.

__init__()#

Methods

__init__()

create_dataset(name, settings)

Create a new dataset with the given name and settings.

create_dataset_as_task(name, settings)

create_or_replace_dataset(name, settings)

Create a new dataset or replace an existing one.

delete_dataset(name)

Delete the given dataset.

delete_dataset_if_exists(name)

Delete the given dataset if it exists.

get_dataset_names(*[, mode, status])

Get the names of all available datasets.

get_default_dataset_name()

Get the default dataset name.

list_riskdatasets()

List all available risk datasets.

load(ref_or_settings, *args, **kwargs)

Load an API instance from settings or reference.

Attributes

settings

Get the settings registry.

abstract get_default_dataset_name() str#

Get the default dataset name.

Returns#

str

The default dataset name that will be populated into settings if no dataset name is provided.

abstract get_dataset_names(*, mode: Literal['System', 'User', 'All'] = 'All', status: Literal['ready', 'available'] = 'ready') list[str]#

Get the names of all available datasets.

Parameters#

modeLiteral[“System”, “User”, “All”], default=”All”

System: only system wide datasets (available to all users and provided by the system). User: only user specific datasets (available to the current user). All: all datasets (system wide and user specific).

statusLiteral[“ready”, “available”], default=”ready”

ready: only datasets that are ready to be used. available: all datasets including those that need to be updated first.

Returns#

list[str]

The names of all available datasets.

abstract list_riskdatasets() list[RiskDatasetMetadata]#

List all available risk datasets.

Returns#

list[RiskDatasetMetadata]

The metadata of all available datasets.

create_or_replace_dataset(name: str, settings: RiskDatasetSettings) RiskDatasetApi#

Create a new dataset or replace an existing one.

Parameters#

namestr

The name of the dataset to create or replace.

settingsRiskDatasetSettings

The settings for the dataset.

Returns#

RiskDatasetApi

The API for the created or replaced dataset.

abstract create_dataset(name: str, settings: RiskDatasetSettings) RiskDatasetApi#

Create a new dataset with the given name and settings.

Parameters#

namestr

The name of the dataset to create.

settingsRiskDatasetSettings

The settings for the dataset to create.

Raises#

DatasetError

If a dataset with the given name already exists or if the settings are otherwise invalid.

Returns#

RiskDatasetApi

The API of the newly created dataset.

abstract create_dataset_as_task(name: str, settings: RiskDatasetSettings) Task[RiskDatasetApi]#
abstract delete_dataset(name: str) RawSettings#

Delete the given dataset.

Parameters#

namestr

The name of the dataset to delete.

Raises#

KeyError

If the dataset does not exist.

DatasetError

If the dataset could not be deleted.

Returns#

RawSettings

The raw settings of the deleted dataset.

delete_dataset_if_exists(name: str) RawSettings | None#

Delete the given dataset if it exists.

Parameters#

namestr

The name of the dataset to delete.

Raises#

DatasetError

If the dataset could not be deleted.

Returns#

RawSettings | None

The raw settings of the deleted dataset if dataset existed.