bayesline.api.equity.ExposureSettings#

pydantic model bayesline.api.equity.ExposureSettings#

Defines exposures as hierarchy of selected styles and substyles.

Show JSON schema
{
   "title": "ExposureSettings",
   "description": "Defines exposures as hierarchy of selected styles and substyles.",
   "type": "object",
   "properties": {
      "market": {
         "default": true,
         "description": "\n        Whether to include the market factor in the model.\n        ",
         "title": "Market",
         "type": "boolean"
      },
      "styles": {
         "anyOf": [
            {
               "additionalProperties": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "\n        A mapping where the keys are style codes or labels and the values are\n        lists of included sub-style names or labels.\n        By default (None) the entire available style/substyle hierarchy will be used.\n        Passing an empty dict will exclude all styles.\n        ",
         "title": "Styles"
      },
      "standardize_styles": {
         "default": true,
         "description": "Whether to standardize the style exposures.",
         "title": "Standardize Styles",
         "type": "boolean"
      },
      "industries": {
         "anyOf": [
            {
               "$ref": "#/$defs/HierarchyLevel"
            },
            {
               "$ref": "#/$defs/HierarchyGroups"
            },
            {
               "type": "null"
            }
         ],
         "description": "\n        The definition of how industry factors are being constructed.\n        The default is to use the same hiearchy as was used to define the universe\n        at level 1 (i.e. coarse grouping).\n        None indicates that no industry factors should be included.\n        ",
         "title": "Industries"
      },
      "regions": {
         "anyOf": [
            {
               "$ref": "#/$defs/HierarchyLevel"
            },
            {
               "$ref": "#/$defs/HierarchyGroups"
            },
            {
               "type": "null"
            }
         ],
         "description": "\n        The definition of how region factors are being constructed.\n        The default is to use the same hiearchy as was used to define the universe\n        at level 2 (i.e. granular grouping).\n        None indicates that no region factors should be included.\n        ",
         "title": "Regions"
      },
      "other": {
         "additionalProperties": {
            "type": "string"
         },
         "description": "\n        A mapping of other factors to include in the model, to the exposure names or\n        labels. For example, to include the risk free rate as an exposure, the mapping\n        could be `{\"Risk Free Rate\": \"us_rate_3m\"}`, or \n        `{\"Risk-Free-Rate\": \"3 Month US TBill Rate\"}`, the key being the exposure name \n        in the output.\n        ",
         "title": "Other",
         "type": "object"
      }
   },
   "$defs": {
      "Hierarchy": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "additionalProperties": {
                  "$ref": "#/$defs/Hierarchy"
               },
               "type": "object"
            }
         ]
      },
      "HierarchyGroups": {
         "description": "The hierarchy group description allows for a nested definition\nof groupings.\nThe top level groupings will turn into factors, whereas any nested\ngroupings will be retained for other uses (e.g. risk decomposition).",
         "properties": {
            "hierarchy": {
               "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": "Hierarchy",
               "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"
            }
         },
         "required": [
            "hierarchy",
            "groupings"
         ],
         "title": "HierarchyGroups",
         "type": "object"
      },
      "HierarchyLevel": {
         "description": "The hierarchy level description turns every name at\nthe configured level into a separate factor.\n\nE.g. for industries specifying level `1` would\ncreate top level sector factors.",
         "properties": {
            "hierarchy": {
               "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": "Hierarchy",
               "type": "string"
            },
            "level": {
               "default": 1,
               "description": "The level of the hierarchy to use, e.g. 1\n        to use all level 1 names (i.e. sectors for industries or\n        continents for regions) or 2 to use all level 2\n        names (i.e. sub-sectors for industries and\n        countries for regions).\n        ",
               "examples": [
                  1,
                  2
               ],
               "minimum": 1,
               "title": "Level",
               "type": "integer"
            }
         },
         "required": [
            "hierarchy"
         ],
         "title": "HierarchyLevel",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • industries (bayesline.api._src.equity.exposure_settings.HierarchyLevel | bayesline.api._src.equity.exposure_settings.HierarchyGroups | None)

  • market (bool)

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

  • regions (bayesline.api._src.equity.exposure_settings.HierarchyLevel | bayesline.api._src.equity.exposure_settings.HierarchyGroups | None)

  • standardize_styles (bool)

  • styles (collections.abc.Mapping[str, list[str]] | None)

classmethod default() ExposureSettings#
field market: bool = True#

Whether to include the market factor in the model.

field styles: Mapping[str, list[str]] | None = None#

A mapping where the keys are style codes or labels and the values are lists of included sub-style names or labels. By default (None) the entire available style/substyle hierarchy will be used. Passing an empty dict will exclude all styles.

field standardize_styles: bool = True#

Whether to standardize the style exposures.

field industries: HierarchyLevel | HierarchyGroups | None [Optional]#

The definition of how industry factors are being constructed. The default is to use the same hiearchy as was used to define the universe at level 1 (i.e. coarse grouping). None indicates that no industry factors should be included.

field regions: HierarchyLevel | HierarchyGroups | None [Optional]#

The definition of how region factors are being constructed. The default is to use the same hiearchy as was used to define the universe at level 2 (i.e. granular grouping). None indicates that no region factors should be included.

field other: Mapping[str, str] [Optional]#

A mapping of other factors to include in the model, to the exposure names or labels. For example, to include the risk free rate as an exposure, the mapping could be {“Risk Free Rate”: “us_rate_3m”}, or {“Risk-Free-Rate”: “3 Month US TBill Rate”}, the key being the exposure name in the output.