bayesline.api.equity.UniverseSettingsMenu#
- pydantic model bayesline.api.equity.UniverseSettingsMenu#
Contain the available settings that can be used for the universe settings.
Show JSON schema
{ "title": "UniverseSettingsMenu", "description": "Contain the available settings that can be used for the universe settings.", "type": "object", "properties": { "calendar_settings_menu": { "$ref": "#/$defs/CalendarSettingsMenu", "description": "The calendar settings menu to use for the universe." }, "id_types": { "description": "\n A list of all the id types that are supported for the universe.\n ", "items": { "enum": [ "bayesid", "bayesid_core", "ticker", "composite_figi", "cik", "cusip8", "cusip9", "isin", "sedol6", "sedol7", "proxy", "name" ], "type": "string" }, "title": "Id Types", "type": "array" }, "categorical_hierarchies": { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "description": "\n A dictionary where the key is the name of the categorical hierarchy (e.g. 'trbc')\n and the value is a N-level nested dictionary structure of the categorical hierarchy\n codes.\n ", "title": "Categorical Hierarchies", "type": "object" }, "categorical_hierarchies_labels": { "additionalProperties": { "additionalProperties": { "type": "string" }, "type": "object" }, "description": "\n A dictionary where the key is the name of the categorical hierarchy and\n the value is a mapping from unique categorical code to a human readable name.\n ", "title": "Categorical Hierarchies Labels", "type": "object" } }, "$defs": { "CalendarSettingsMenu": { "additionalProperties": false, "description": "Contain the available settings that can be used for the calendar settings.", "properties": { "exchanges": { "description": "\n A list of mic codes of all exchanges. Must be sorted and unique.\n ", "items": { "type": "string" }, "title": "Exchanges", "type": "array" } }, "required": [ "exchanges" ], "title": "CalendarSettingsMenu", "type": "object" }, "Hierarchy": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "type": "object" } ] } }, "additionalProperties": false, "required": [ "calendar_settings_menu", "id_types", "categorical_hierarchies", "categorical_hierarchies_labels" ] }
- Config:
frozen: bool = True
extra: str = forbid
- Fields:
calendar_settings_menu (bayesline.api._src.equity.calendar_settings.CalendarSettingsMenu)categorical_hierarchies (collections.abc.Mapping[str, Hierarchy])categorical_hierarchies_labels (collections.abc.Mapping[str, collections.abc.Mapping[str, str]])id_types (list[Literal['bayesid', 'bayesid_core', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name']])
- Validators:
check_all_codes_have_labels»all fieldscheck_no_empty_branches»categorical_hierarchiescheck_unique_hierarchy»categorical_hierarchies
- field calendar_settings_menu: CalendarSettingsMenu [Required]#
The calendar settings menu to use for the universe.
- Validated by:
check_all_codes_have_labels
- field id_types: list[IdType] [Required]#
A list of all the id types that are supported for the universe.
- Validated by:
check_all_codes_have_labels
- field categorical_hierarchies: Mapping[str, Hierarchy] [Required]#
A dictionary where the key is the name of the categorical hierarchy (e.g. ‘trbc’) and the value is a N-level nested dictionary structure of the categorical hierarchy codes.
- Validated by:
check_all_codes_have_labelscheck_no_empty_branchescheck_unique_hierarchy
- field categorical_hierarchies_labels: Mapping[str, Mapping[str, str]] [Required]#
A dictionary where the key is the name of the categorical hierarchy and the value is a mapping from unique categorical code to a human readable name.
- Validated by:
check_all_codes_have_labels
- validator check_no_empty_branches → Mapping[str, Mapping[str, Hierarchy]] » categorical_hierarchies#
- validator check_all_codes_have_labels → UniverseSettingsMenu » all fields#
- describe() → str#
Generate a human-readable description of the universe settings.
Returns#
- str
A formatted description of the universe settings menu.
- effective_categories(settings: CategoricalFilterSettings, labels: bool = False) → list[str]#
Get the effective leaf level categorical codes after categorical filtering.
Parameters#
- settingsCategoricalFilterSettings
The filter settings to get the effective categorical codes for.
- labelsbool, default=False
Whether to return the labels or the codes.
Returns#
- list[str]
The effective leaf level categorical codes for the given settings after the filters were applied.
- hierarchy_df(hierarchy: str) → DataFrame#
Return a dataframe of the given categorical hierarchy.
Parameters#
- hierarchystr
The name of the categorical hierarchy to return.
Returns#
- pl.DataFrame
The wide DataFrame representation of the hierarchy. The columns are: - level_1: The code of the root level. - level_1_label: The label of the root level. - level_2: The code of the second level. - level_2_label: The label of the second level. - … - level_n: The code of the n-th level. - level_n_label: The label of the n-th level.