bayesline.api.equity.CategoricalFilterSettings#

pydantic model bayesline.api.equity.CategoricalFilterSettings#

Specify include and exclude filters for categorical codes.

Examples of categorical codes are industries or countries. Assets are included if they are part of at least one include and not part of any exclude.

By default all codes for the given hierarchy are included.

Show JSON schema
{
   "title": "CategoricalFilterSettings",
   "description": "Specify include and exclude filters for categorical codes.\n\nExamples of categorical codes are industries or countries. Assets are included if\nthey are part of at least one include and not part of any exclude.\n\nBy default all codes for the given hierarchy are included.",
   "type": "object",
   "properties": {
      "hierarchy": {
         "description": "The categorical hierarchy to use.",
         "examples": [
            "trbc"
         ],
         "minLength": 1,
         "title": "Hierarchy",
         "type": "string"
      },
      "include": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "const": "All",
               "type": "string"
            }
         ],
         "default": "All",
         "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the highest level is used. If 'All', all codes are included.",
         "examples": [
            [
               "3571"
            ],
            "All",
            [
               "Materials",
               "1010"
            ],
            [
               "Europe",
               "CAN"
            ]
         ],
         "title": "Include"
      },
      "exclude": {
         "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the lowest level is used.",
         "examples": [
            [
               "3571"
            ],
            [
               "Materials",
               "1010"
            ],
            [
               "JPN"
            ]
         ],
         "items": {
            "type": "string"
         },
         "title": "Exclude",
         "type": "array"
      }
   },
   "additionalProperties": false,
   "required": [
      "hierarchy"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • exclude (list[str])

  • hierarchy (str)

  • include (list[str] | Literal['All'])

Validators:
  • validate_filters » all fields

field hierarchy: str [Required]#

The categorical hierarchy to use.

Constraints:
  • min_length = 1

Validated by:
  • validate_filters

field include: list[str] | Literal['All'] = 'All'#

Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the highest level is used. If ‘All’, all codes are included.

Validated by:
  • validate_filters

field exclude: list[str] [Optional]#

Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the lowest level is used.

Validated by:
  • validate_filters

validator validate_filters CategoricalFilterSettings  »  all fields#
validate_settings(menu: UniverseSettingsMenu | None) None#

Validate the categorical filter settings.

Parameters#

menuUniverseSettingsMenu | None

The menu to validate against. If None, the categorical filter settings is validated without having the menu context. This means that less validation is done.