bayesline.api.equity.RootRiskDatasetSettings

bayesline.api.equity.RootRiskDatasetSettings#

model RootRiskDatasetSettings#

Settings for creating a root risk dataset directly from uploads.

A root dataset has no reference dataset. It is assembled by reading from seven upload sources (market_cap, price, exposures, exchange_dates, exchange_rates, series, idmap) and producing a ConsolidatedDataParams that can subsequently be referenced by the standard DerivedRiskDatasetSettings flow.

All upload rows are expected to be in master-id space (asset_id_type column equal to master_id_type). Foreign-id rows in the same uploads are tolerated but ignored during root-dataset construction.

Shares the joint RiskDatasetSettingsMenu with DerivedRiskDatasetSettings; the validator populates the available_*_sources fields relevant to this variant. The kind discriminator routes Pydantic-union dispatch.

Fields#

Field

Type

Required

Default

as_of_date

str | date | datetime

Yes

dense_factor_groups

dict[str, str | None]

No

factory

exchange_dates_source

str

Yes

exchange_rates_source

str

Yes

exposures_source

str

Yes

idmap_source

str

Yes

kind

Literal[‘root’]

No

'root'

market_cap_source

str

Yes

master_id_core_type

str

No

'bayesid_core'

master_id_type

str

No

'bayesid'

price_source

str

Yes

series_source

str | None

No

None

sparse_factor_groups

dict[str, str | None]

No

factory

field as_of_date: str | date | datetime [Required]#

Snapshot date for the IdMapper. Only id-mapping rows whose start_date <= as_of_date are retained when constructing the dataset’s IdMapper. Pick the date as of which the uploaded idmap should be considered authoritative — typically the most recent date for which the upload contains complete mappings. Accepts a date, datetime, or ISO-format string; the consumer normalizes via to_date(...).

field dense_factor_groups: dict[str, str | None] [Optional]#

Mapping of dense factor-group name to hierarchy upload source. Use None as the value to use a default flat hierarchy.

field exchange_dates_source: str [Required]#

Upload source name providing trading-day membership per exchange: (date, exchange).

field exchange_rates_source: str [Required]#

Upload source name providing single-base USD FX rates: (date, ccy, fx_rate).

field exposures_source: str [Required]#

Upload source name providing factor exposures: (date, asset_id, asset_id_type, factor_group, factor, exposure).

field idmap_source: str [Required]#

Upload source name providing the id-map table: (start_date, end_date, from_id_type, from_id, to_id_type, to_id). The (master_id_type -> master_id_core_type) projection is extracted during dataset construction.

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

Discriminator field for the risk dataset settings union. root selects this variant for datasets built directly from upload sources (no reference dataset).

field market_cap_source: str [Required]#

Upload source name providing per-asset-day market-cap data: (date, asset_id, asset_id_type, ccy, market_cap, volume, idio_vol).

field master_id_core_type: str [Optional]#

The canonical core-asset-id type. Used to extract the asset-to-core mapping from the idmap upload.

field master_id_type: str [Optional]#

The canonical asset-id type. Upload rows whose asset_id_type does not equal this value are ignored.

field price_source: str [Required]#

Upload source name providing prices: (date, asset_id, asset_id_type, ccy, close, return, delisted).

field series_source: str | None [Optional]#

Upload source name providing time series in long format: (date, series, value). Optional.

field sparse_factor_groups: dict[str, str | None] [Optional]#

Mapping of sparse factor-group name to hierarchy upload source. Use None as the value to use a default flat hierarchy.