bayesline.api.equity.DerivedRiskDatasetSettings

bayesline.api.equity.DerivedRiskDatasetSettings#

model DerivedRiskDatasetSettings#

Settings for creating a derived risk dataset built on top of a parent.

A derived dataset is configured by selecting a reference dataset, optionally overriding exposures, filtering assets/exchanges, and trimming dates. All underlying market data is sourced from the reference dataset.

For datasets assembled directly from upload sources (no parent), see RootRiskDatasetSettings. The discriminated union of both variants is exposed as AnyRiskDatasetSettings.

Fields#

Field

Type

Required

Default

Constraints

exchange_codes

list[str] | None

No

None

exposures

list[Annotated[RiskDatasetReferencedExposureSettings | RiskDatasetUploadedExposureSettings | RiskDatasetHuberRegressionExposureSettings | RiskDatasetUnitExposureSettings, FieldInfo(annotation=NoneType, required=True, discriminator=’exposure_type’)]]

No

factory

min_length=1

is_system_wide

bool

No

False

kind

Literal[‘derived’]

No

'derived'

reference_dataset

str | int

Yes

trim_assets

Literal[‘none’, ‘asset_union’, ‘ccy_union’]

No

'none'

trim_assets_sources

list[str] | None

No

None

trim_end_date

Literal[‘none’, ‘earliest_end’, ‘latest_end’] | date

No

'latest_end'

trim_start_date

Literal[‘none’, ‘earliest_start’, ‘latest_start’] | date

No

'earliest_start'

Validators#

Validator

Mode

Fields

validate_reference_dataset

after

reference_dataset

field exchange_codes: list[str] | None [Optional]#

The exchange codes to filter the reference dataset down to.

field exposures: list[Annotated[RiskDatasetReferencedExposureSettings | RiskDatasetUploadedExposureSettings | RiskDatasetHuberRegressionExposureSettings | RiskDatasetUnitExposureSettings, FieldInfo(annotation=NoneType, required=True, discriminator='exposure_type')]] [Optional]#

The exposures to use for the new dataset. By default the reference dataset is copied as a basis for the new dataset.

Constraints:
  • min_length = 1

field is_system_wide: bool [Optional]#

Whether the risk dataset is system wide and provided by Bayesline.

field kind: Literal['derived'] [Optional]#

Discriminator field for the risk dataset settings union (derived vs root). Use derived for datasets built on top of a parent reference dataset; use root (on RootRiskDatasetSettings) for datasets built directly from upload sources.

field reference_dataset: str | int [Required]#

The dataset (either name or global int identifier) to use as a basis for the new dataset. All data will be sourced from this dataset.

Validated by:

validate_reference_dataset

field trim_assets: Literal['none', 'asset_union', 'ccy_union'] [Optional]#

Whether to trim the assets based on the uploaded exposures. If ‘none’, the assets are not trimmed. If ‘asset_union’, the assets are trimmed to the union of the asset ids in the uploaded exposures. If ‘ccy_union’, the assets are trimmed to the union of all currencies in the uploaded exposures.

field trim_assets_sources: list[str] | None [Optional]#

Restrict the asset/ccy union used by trim_assets to these upload sources. None (default) preserves the prior behaviour: the union is taken across every uploaded-exposure source in exposures. Each entry must be the exposure_source of an uploaded-type entry in exposures. Only meaningful when trim_assets is 'asset_union' or 'ccy_union'.

field trim_end_date: Literal['none', 'earliest_end', 'latest_end'] | date [Optional]#

Whether to trim the end date based on the uploaded exposures. If ‘none’, the end date is not trimmed. If ‘earliest_end’, the end date is trimmed to the earliest end date of the uploaded exposures, or the uploaded exposures and the reference dataset when referenced exposures are provided. If ‘latest_end’, the end date is trimmed to the latest end date of the uploaded exposures, or the uploaded exposures and the reference dataset when referenced exposures are provided. If a date is provided, the end date is trimmed to the provided date.

field trim_start_date: Literal['none', 'earliest_start', 'latest_start'] | date [Optional]#

Whether to trim the start date based on the uploaded exposures. If ‘none’, the start date is not trimmed. If ‘earliest_start’, the start date is trimmed to the earliest start date of the uploaded exposures, or the uploaded exposures and the reference dataset when referenced exposures are provided. If ‘latest_start’, the start date is trimmed to the latest start date the uploaded exposures, or the uploaded exposures and the reference dataset when referenced exposures are provided. If a date is provided, the start date is trimmed to the provided date.

validator validate_reference_dataset(mode=after)#
Validates:

reference_dataset