bayesline.api.equity.ExposureSettingsMenu#
- pydantic model bayesline.api.equity.ExposureSettingsMenu#
Contains the available settings that can be used to define exposures.
Show JSON schema
{ "title": "ExposureSettingsMenu", "description": "Contains the available settings that can be used to define exposures.", "type": "object", "properties": { "market": { "description": "\n The unique market factor code to use in the model.\n ", "title": "Market", "type": "string" }, "styles": { "additionalProperties": { "items": { "type": "string" }, "type": "array" }, "description": "\n A mapping where the key is the name of an exposure style codes (e.g. 'LEVERAGE')\n and the value is a list of available sub-style codes (e.g. 'DEBT_TO_ASSETS')\n ", "title": "Styles", "type": "object" }, "industries": { "additionalProperties": { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "type": "object" }, "description": "\n A dictionary where the key is the name of the industry hierarchy (e.g. 'TRBC')\n and the value is a N-level nested dictionary structure of the industry hierarchy\n codes.\n ", "title": "Industries", "type": "object" }, "regions": { "additionalProperties": { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "type": "object" }, "description": "\n A dictionary where the key is the name of the region hierarchy (e.g.\n 'CONTINENT') and the value is a N-level nested dictionary structure of the\n region hierarchy codes.\n ", "title": "Regions", "type": "object" }, "other": { "description": "\n A set of other factor codes that can be included in the model.\n ", "items": { "type": "string" }, "title": "Other", "type": "array", "uniqueItems": true }, "market_labels": { "additionalProperties": { "type": "string" }, "description": "\n A mapping from unique market factor code to a human readable name. This is just \n one pair, but the name is `market_labels` to be consistent.\n ", "maxProperties": 1, "minProperties": 1, "title": "Market Labels", "type": "object" }, "style_labels": { "additionalProperties": { "type": "string" }, "description": "\n A mapping from unique style/substyle code to a human readable name.\n ", "title": "Style Labels", "type": "object" }, "industry_labels": { "additionalProperties": { "additionalProperties": { "type": "string" }, "type": "object" }, "description": "\n A dictionary where the key is the name of the industry hierarchy and\n the value is a mapping from unique industry code to a human readable name.\n ", "title": "Industry Labels", "type": "object" }, "region_labels": { "additionalProperties": { "additionalProperties": { "type": "string" }, "type": "object" }, "description": "\n A dictionary where the key is the name of the region hierarchy and\n the value is a mapping from unique region code to a human readable name.\n ", "title": "Region Labels", "type": "object" }, "other_labels": { "additionalProperties": { "type": "string" }, "description": "\n A mapping from unique other factor code to a human readable name.\n ", "title": "Other Labels", "type": "object" } }, "$defs": { "Hierarchy": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "type": "object" } ] } }, "additionalProperties": false, "required": [ "market", "styles", "industries", "regions", "other", "market_labels", "style_labels", "industry_labels", "region_labels", "other_labels" ] }
- Config:
frozen: bool = True
extra: str = forbid
- Fields:
industries (collections.abc.Mapping[str, collections.abc.Mapping[str, Hierarchy]])
industry_labels (collections.abc.Mapping[str, collections.abc.Mapping[str, str]])
market (str)
market_labels (collections.abc.Mapping[str, str])
other (set[str])
other_labels (collections.abc.Mapping[str, str])
region_labels (collections.abc.Mapping[str, collections.abc.Mapping[str, str]])
regions (collections.abc.Mapping[str, collections.abc.Mapping[str, Hierarchy]])
style_labels (collections.abc.Mapping[str, str])
styles (collections.abc.Mapping[str, list[str]])
- Validators:
check_all_codes_have_labels
»all fields
check_nonempty_hierarchy
»industries
check_nonempty_hierarchy
»regions
check_nonempty_hierarchy_if_provided
»styles
check_unique_hierarchy
»industries
check_unique_hierarchy
»regions
check_unique_hierarchy
»styles
-
field market:
str
[Required]# The unique market factor code to use in the model.
- Validated by:
check_all_codes_have_labels
-
field styles:
Mapping
[str
,list
[str
]] [Required]# A mapping where the key is the name of an exposure style codes (e.g. ‘LEVERAGE’) and the value is a list of available sub-style codes (e.g. ‘DEBT_TO_ASSETS’)
- Validated by:
check_all_codes_have_labels
check_nonempty_hierarchy_if_provided
check_unique_hierarchy
-
field industries:
Mapping
[str
,Mapping
[str
,TypeAliasType
]] [Required]# A dictionary where the key is the name of the industry hierarchy (e.g. ‘TRBC’) and the value is a N-level nested dictionary structure of the industry hierarchy codes.
- Validated by:
check_all_codes_have_labels
check_nonempty_hierarchy
check_unique_hierarchy
-
field regions:
Mapping
[str
,Mapping
[str
,TypeAliasType
]] [Required]# A dictionary where the key is the name of the region hierarchy (e.g. ‘CONTINENT’) and the value is a N-level nested dictionary structure of the region hierarchy codes.
- Validated by:
check_all_codes_have_labels
check_nonempty_hierarchy
check_unique_hierarchy
-
field other:
set
[str
] [Required]# A set of other factor codes that can be included in the model.
- Validated by:
check_all_codes_have_labels
-
field market_labels:
Mapping
[str
,str
] [Required]# A mapping from unique market factor code to a human readable name. This is just one pair, but the name is market_labels to be consistent.
- Constraints:
min_length = 1
max_length = 1
- Validated by:
check_all_codes_have_labels
-
field style_labels:
Mapping
[str
,str
] [Required]# A mapping from unique style/substyle code to a human readable name.
- Validated by:
check_all_codes_have_labels
-
field industry_labels:
Mapping
[str
,Mapping
[str
,str
]] [Required]# A dictionary where the key is the name of the industry hierarchy and the value is a mapping from unique industry code to a human readable name.
- Validated by:
check_all_codes_have_labels
-
field region_labels:
Mapping
[str
,Mapping
[str
,str
]] [Required]# A dictionary where the key is the name of the region hierarchy and the value is a mapping from unique region code to a human readable name.
- Validated by:
check_all_codes_have_labels
-
field other_labels:
Mapping
[str
,str
] [Required]# A mapping from unique other factor code to a human readable name.
- Validated by:
check_all_codes_have_labels
- effective_industry_hierarchy(filter_settings: IndustrySettings, settings: HierarchyLevel | HierarchyGroups | None) → Mapping[str, Hierarchy]#
Parameters#
- filter_settings: IndustrySettings
the settings to use to filter the universe.
- settings: HierarchyLevel | HierarchyGroups | None
the settings to use to determine the industry factors.
Returns#
A dict structure where the keys are the industry factor names and the values are the industry codes that are included in that factor.
- effective_region_hierarchy(filter_settings: RegionSettings, settings: HierarchyLevel | HierarchyGroups | None) → Mapping[str, Hierarchy]#
Parameters#
- filter_settings: RegionSettings
the settings to use to filter the universe.
- settings: HierarchyLevel | HierarchyGroups | None
the settings to use to determine the region factors.
Returns#
A dict structure where the keys are the region factor names and the values are the region codes that are included in that factor.
- normalize(universe_settings: UniverseSettings, exposure_settings: ExposureSettings) → ExposureSettings#
Normalizes the given exposure settings by converting all style and substyle codes/labels to their corresponding codes/labels.
Parameters#
- universe_settings: UniverseSettings
the universe settings to use for normalization.
- exposure_settings: ExposureSettings
the exposure settings to normalize.
Returns#
A new exposure settings object with all style and substyle code/labels converted to codes/labels.
- all_substyles(settings: ExposureSettings | None = None, *, labels: bool = False) → list[str]#
Parameters#
- settings: ExposureSettings, optional
the exposure settings to get all substyles for.
- labels: bool, optional
whether to return the substyles as labels or codes.
Returns#
A sorted flat list of all substyles in this settings menu or all configured substyles if a settings object is given.
- describe(settings: ExposureSettings | None = None) → str#
Parameters#
- settingsSettingsType | None
The settings to describe. If None, then the description is not evaluated against any settings.
Returns#
A human readable description of the settings menu, optionally evaluated against the given settings.
- validator check_unique_hierarchy → Mapping[str, Mapping[str, Hierarchy]] » regions, industries, styles#
- validator check_all_codes_have_labels → ExposureSettingsMenu » all fields#
- validate_settings(settings: ExposureSettings) → None#
Validates the given exposure settings against the available settings.
Will raise an ValueError if settings are invalid.
Parameters#
- settings: ExposureSettings
the exposure settings to validate against.
- validate_styles(settings: Mapping[str, list[str]] | None) → None#
Validates the given style settings against the available settings.
Will raise an ValueError if settings are invalid.
Parameters#
- settings: Mapping[str, list[str]]
the style settings to validate against.