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": {
      "universe_settings_menu": {
         "$ref": "#/$defs/UniverseSettingsMenu",
         "description": "The universe settings menu to use to define the exposures."
      },
      "continuous_hierarchies": {
         "additionalProperties": {
            "$ref": "#/$defs/Hierarchy"
         },
         "description": "\n        A dictionary where the key is the name of the continuous hierarchy (e.g. 'style')\n        and the value is a N-level nested dictionary structure of the continuous hierarchy\n        codes.\n        ",
         "title": "Continuous Hierarchies",
         "type": "object"
      },
      "continuous_hierarchies_labels": {
         "additionalProperties": {
            "additionalProperties": {
               "type": "string"
            },
            "type": "object"
         },
         "description": "\n        A dictionary where the key is the name of the continuous hierarchy and\n        the value is a mapping from unique continuous code to a human readable name.\n        ",
         "title": "Continuous 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"
            }
         ]
      },
      "UniverseSettingsMenu": {
         "additionalProperties": false,
         "description": "Contain the available settings that can be used for the universe settings.",
         "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"
            }
         },
         "required": [
            "calendar_settings_menu",
            "id_types",
            "categorical_hierarchies",
            "categorical_hierarchies_labels"
         ],
         "title": "UniverseSettingsMenu",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "universe_settings_menu",
      "continuous_hierarchies",
      "continuous_hierarchies_labels"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • continuous_hierarchies (collections.abc.Mapping[str, Hierarchy])

  • continuous_hierarchies_labels (collections.abc.Mapping[str, collections.abc.Mapping[str, str]])

  • universe_settings_menu (bayesline.api._src.equity.universe_settings.UniverseSettingsMenu)

Validators:
  • check_all_codes_have_labels » all fields

  • check_no_empty_branches » continuous_hierarchies

  • check_unique_hierarchy » continuous_hierarchies

field universe_settings_menu: UniverseSettingsMenu [Required]#

The universe settings menu to use to define the exposures.

Validated by:
  • check_all_codes_have_labels

field continuous_hierarchies: Mapping[str, Hierarchy] [Required]#

A dictionary where the key is the name of the continuous hierarchy (e.g. ‘style’) and the value is a N-level nested dictionary structure of the continuous hierarchy codes.

Validated by:
  • check_all_codes_have_labels

  • check_no_empty_branches

  • check_unique_hierarchy

field continuous_hierarchies_labels: Mapping[str, Mapping[str, str]] [Required]#

A dictionary where the key is the name of the continuous hierarchy and the value is a mapping from unique continuous code to a human readable name.

Validated by:
  • check_all_codes_have_labels

property calendar_settings_menu: CalendarSettingsMenu#

The calendar settings menu from the universe settings menu.

Returns#

CalendarSettingsMenu

The calendar settings menu from the universe settings menu.

property categorical_hierarchies: Mapping[str, Hierarchy]#

The categorical hierarchies from the universe settings menu.

Returns#

Mapping[str, Hierarchy]

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.

property categorical_hierarchies_labels: Mapping[str, Mapping[str, str]]#

The categorical hierarchies labels from the universe settings menu.

Returns#

Mapping[str, Mapping[str, str]]

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.

property hierarchies: Mapping[str, Hierarchy]#

The combined hierarchies from the continuous and categorical hierarchies.

Returns#

Mapping[str, Hierarchy]

A dictionary where the key is the name of the hierarchy and the value is the hierarchy.

property hierarchies_labels: Mapping[str, Mapping[str, str]]#

The combined hierarchies labels from the continuous and categorical hierarchies.

Returns#

Mapping[str, Mapping[str, str]]

A dictionary where the key is the name of the hierarchy and the value is a mapping from unique code to a human readable name.

describe() str#

Describe the exposure settings menu.

Returns#

str

The description of the exposure settings menu.

validator check_unique_hierarchy Mapping[str, Hierarchy]  »  continuous_hierarchies#
validator check_no_empty_branches Mapping[str, Hierarchy]  »  continuous_hierarchies#
validator check_all_codes_have_labels ExposureSettingsMenu  »  all fields#
hierarchy_df(hierarchy: str) DataFrame#

Return a dataframe of the given hierarchy.

Parameters#

hierarchy: str

the name of the 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.