bayesline.api.equity.UniverseSettingsMenu#

pydantic model bayesline.api.equity.UniverseSettingsMenu#

Contains the available settings that can be used for the universe settings.

Show JSON schema
{
   "title": "UniverseSettingsMenu",
   "description": "Contains the available settings that can be used for the universe settings.",
   "type": "object",
   "properties": {
      "id_types": {
         "description": "\n        A list of all the id types that are supported for the universe.\n        ",
         "items": {
            "enum": [
               "bayesid",
               "ticker",
               "composite_figi",
               "cik",
               "cusip8",
               "cusip9",
               "isin",
               "sedol6",
               "sedol7",
               "proxy",
               "name"
            ],
            "type": "string"
         },
         "title": "Id Types",
         "type": "array"
      },
      "exchanges": {
         "description": "\n        A list of mic codes of all exchanges. Must be sorted and unique.\n        ",
         "items": {
            "type": "string"
         },
         "title": "Exchanges",
         "type": "array"
      },
      "industry": {
         "additionalProperties": {
            "additionalProperties": {
               "$ref": "#/$defs/Hierarchy"
            },
            "type": "object"
         },
         "description": "\n        A dictionary where the key is the name of the industry hierarchy (e.g. 'GICS')\n        and the value is a N-level nested dictionary structure of the industry hierarchy\n        codes.\n        ",
         "title": "Industry",
         "type": "object"
      },
      "region": {
         "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": "Region",
         "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"
      }
   },
   "$defs": {
      "Hierarchy": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "additionalProperties": {
                  "$ref": "#/$defs/Hierarchy"
               },
               "type": "object"
            }
         ]
      }
   },
   "additionalProperties": false,
   "required": [
      "id_types",
      "exchanges",
      "industry",
      "region",
      "industry_labels",
      "region_labels"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • exchanges (list[str])

  • id_types (list[Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name']])

  • industry (collections.abc.Mapping[str, collections.abc.Mapping[str, Hierarchy]])

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

  • region (collections.abc.Mapping[str, collections.abc.Mapping[str, Hierarchy]])

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

Validators:
  • check_all_codes_have_labels » all fields

  • check_nonempty_hierarchy » industry

  • check_nonempty_hierarchy » region

  • check_unique_hierarchy » industry

  • check_unique_hierarchy » region

field id_types: list[Literal['bayesid', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name']] [Required]#

A list of all the id types that are supported for the universe.

Validated by:
  • check_all_codes_have_labels

field exchanges: Annotated[list[str]] [Required]#

A list of mic codes of all exchanges. Must be sorted and unique.

Constraints:
  • func = <function require_sorted_unique at 0x7ff51ab19800>

Validated by:
  • check_all_codes_have_labels

field industry: Mapping[str, Mapping[str, TypeAliasType]] [Required]#

A dictionary where the key is the name of the industry hierarchy (e.g. ‘GICS’) 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 region: 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 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

describe(settings: UniverseSettings | 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]]  »  industry, region#
validator check_nonempty_hierarchy Mapping[str, Mapping[str, Hierarchy]]  »  region, industry#
validator check_all_codes_have_labels UniverseSettingsMenu  »  all fields#
effective_industries(settings: IndustrySettings, labels: bool = False) list[str]#

Parameters#

settings: IndustrySettings

the industry settings to get the effective industries for.

labels: bool

whether to return the labels or the codes.

Returns#

The effective leaf level industries for the given settings after the filters were applied.

effective_regions(settings: RegionSettings, labels: bool = False) list[str]#

Parameters#

settings: RegionSettings

the region settings to get the effective regions for.

labels: bool

whether to return the labels or the codes.

Returns#

The effective leaf level regions for the given settings after the filters were applied.

validate_settings(settings: UniverseSettings) None#

Validates the given universe settings against the available settings.

Will raise an ValueError if settings are invalid.

Parameters#

settings: UniverseSettings

the universe settings to validate against.

validate_calendar(settings: CalendarSettings) None#

Validates the given calendar settings against the available settings.

Will raise an ValueError if settings are invalid.

Parameters#

settings: CalendarSettings

the calendar settings to validate against.

validate_industry(settings: IndustrySettings) None#

Validates the given industry settings against the available settings.

Will raise an ValueError if settings are invalid.

Parameters#

settings: IndustrySettings

the industry settings to validate against.

validate_region(settings: RegionSettings) None#

Validates the given region settings against the available settings.

Will raise an ValueError if settings are invalid.

Parameters#

settings: RegionSettings

the region settings to validate against.

static get_effective_includes(hierarchy: Mapping[str, Hierarchy], includes: list[str] | Literal['All'], excludes: list[str], labels: Mapping[str, str]) list[str]#