bayesline.api.equity.HierarchyGroups#

pydantic model bayesline.api.equity.HierarchyGroups#

The hierarchy decscription for a custom nested grouping of the hierarchy.

The top level groupings will turn into factors, whereas any nested groupings will be retained for other uses (e.g. risk decomposition).

Show JSON schema
{
   "title": "HierarchyGroups",
   "description": "The hierarchy decscription for a custom nested grouping of the hierarchy.\n\nThe top level groupings will turn into factors, whereas any nested\ngroupings will be retained for other uses (e.g. risk decomposition).",
   "type": "object",
   "properties": {
      "hierarchy_type": {
         "const": "groups",
         "default": "groups",
         "title": "Hierarchy Type",
         "type": "string"
      },
      "name": {
         "description": "\n        The name of the hierarchy to use, e.g. 'trbc' or 'continent'.\n        If it is not given then the default hierarchy will be used.\n        ",
         "examples": [
            "trbc",
            "continent"
         ],
         "minLength": 1,
         "title": "Name",
         "type": "string"
      },
      "groupings": {
         "additionalProperties": {
            "$ref": "#/$defs/Hierarchy"
         },
         "description": "\n        A nested structure of groupings where the keys are the group names\n        and the leaf level is a list of hierarchy codes or labels (at any level)\n        to include for this group.\n        ",
         "title": "Groupings",
         "type": "object"
      }
   },
   "$defs": {
      "Hierarchy": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "additionalProperties": {
                  "$ref": "#/$defs/Hierarchy"
               },
               "type": "object"
            }
         ]
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "groupings"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

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

  • hierarchy_type (Literal['groups'])

Validators:
  • check_valid_groupings » groupings

field hierarchy_type: Literal['groups'] = 'groups'#
field groupings: Mapping[str, Hierarchy] [Required]#

A nested structure of groupings where the keys are the group names and the leaf level is a list of hierarchy codes or labels (at any level) to include for this group.

Validated by:
  • check_valid_groupings

validator check_valid_groupings Mapping[str, Hierarchy]  »  groupings#