bayesline.api.equity.UniverseSettings#

pydantic model bayesline.api.equity.UniverseSettings#

Define an asset universe as a set of regional, industry and market cap filters.

Show JSON schema
{
   "title": "UniverseSettings",
   "description": "Define an asset universe as a set of regional, industry and market cap filters.",
   "type": "object",
   "properties": {
      "dataset": {
         "description": "The name of the underlying dataset to use. If none is given then the configured default dataset is used.",
         "examples": [
            "Bayesline-Global"
         ],
         "title": "Dataset",
         "type": "string"
      },
      "id_type": {
         "default": "bayesid",
         "description": "The default id type to use for the universe.",
         "enum": [
            "bayesid",
            "bayesid_core",
            "ticker",
            "composite_figi",
            "cik",
            "cusip8",
            "cusip9",
            "isin",
            "sedol6",
            "sedol7",
            "proxy",
            "name"
         ],
         "examples": [
            "cusip9",
            "bayesid"
         ],
         "title": "Id Type",
         "type": "string"
      },
      "calendar": {
         "$ref": "#/$defs/CalendarSettings",
         "description": "The calendar settings to use for the universe."
      },
      "categorical_filters": {
         "description": "\n        Filters that determine which categorical codes to include and exclude in the universe.\n        ",
         "items": {
            "$ref": "#/$defs/CategoricalFilterSettings"
         },
         "title": "Categorical Filters",
         "type": "array"
      },
      "portfolio_filter": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "integer"
            },
            {
               "$ref": "#/$defs/PortfolioOrganizerSettings"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The portfolio organizer settings to use as an underlying schema of portfolios. Universe will be filtered across the superset of all portfolios.",
         "title": "Portfolio Filter"
      },
      "mcap_filter": {
         "$ref": "#/$defs/MCapFilterSettings",
         "description": "\n        Filters that determine which market caps to include and exclude in the universe.\n        "
      }
   },
   "$defs": {
      "CalendarSettings": {
         "additionalProperties": false,
         "description": "Define the settings for the calendar.",
         "properties": {
            "dataset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the underlying dataset to use. If none is given then the configured default dataset is used.",
               "examples": [
                  "Bayesline-US"
               ],
               "title": "Dataset"
            },
            "filters": {
               "default": [
                  [
                     "XNYS"
                  ]
               ],
               "description": "The filters to apply. Each filter is a list of exchange MIC codes. The outer list will be treated as an OR conditions, while the inner lists will be treated as an AND conditions. For example, `[['A', 'B'], ['C']]` means that the holidays are the days where either A and B are both holidays, or C is a holiday.",
               "examples": [
                  [
                     [
                        "XNYS"
                     ]
                  ],
                  [
                     [
                        "XNYS",
                        "XNAS"
                     ]
                  ],
                  [
                     [
                        "XNYS"
                     ],
                     [
                        "XNAS"
                     ]
                  ]
               ],
               "items": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "minItems": 1,
               "title": "Filters",
               "type": "array"
            }
         },
         "title": "CalendarSettings",
         "type": "object"
      },
      "CategoricalFilterSettings": {
         "additionalProperties": false,
         "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.",
         "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"
            }
         },
         "required": [
            "hierarchy"
         ],
         "title": "CategoricalFilterSettings",
         "type": "object"
      },
      "MCapFilterSettings": {
         "additionalProperties": false,
         "description": "Specify the lower and upper bound for the market cap filter.\n\nBy default the bounds are infinite.",
         "properties": {
            "lower": {
               "default": 0.0,
               "description": "Lower bound of the cap filter in USD.",
               "examples": [
                  10000000000.0
               ],
               "minimum": 0,
               "title": "Lower",
               "type": "number"
            },
            "upper": {
               "default": 1e+20,
               "description": "Upper bound of the cap filter in USD.",
               "examples": [
                  1000000000000.0
               ],
               "exclusiveMinimum": 0.0,
               "minimum": 0,
               "title": "Upper",
               "type": "number"
            }
         },
         "title": "MCapFilterSettings",
         "type": "object"
      },
      "PortfolioOrganizerSettings": {
         "additionalProperties": false,
         "description": "Specifies which portfolios to enable (from different sources).\n\nDifferent sources (e.g. uploaded portfolios) can provide the same portfolio\nidentifiers. These settings allow to specify which portfolios to enable from\nwhich sources.",
         "properties": {
            "dataset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the underlying dataset to use for price data needed to forward fill portfolios, obtain corporate actions, etc.If none is given then the configured default dataset is used.",
               "examples": [
                  "Bayesline-US"
               ],
               "title": "Dataset"
            },
            "enabled_portfolios": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "additionalProperties": {
                        "type": "string"
                     },
                     "type": "object"
                  }
               ],
               "description": "The enabled portfolios from different sources. The key is the portfolio ID, and the value is the source (name of the underlying portfolio service). Pass a str to reference an entire portfolio source (e.g. all portfolios from an upload).",
               "title": "Enabled Portfolios"
            }
         },
         "required": [
            "enabled_portfolios"
         ],
         "title": "PortfolioOrganizerSettings",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "dataset"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • calendar (bayesline.api._src.equity.calendar_settings.CalendarSettings)

  • categorical_filters (list[bayesline.api._src.equity.universe_settings.CategoricalFilterSettings])

  • dataset (str)

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

  • mcap_filter (bayesline.api._src.equity.universe_settings.MCapFilterSettings)

  • portfolio_filter (str | int | bayesline.api._src.equity.portfolio_settings.PortfolioOrganizerSettings | None)

Validators:
  • check_unique_filters » categorical_filters

  • propagate_dataset » all fields

  • validate_calendar » calendar

  • validate_categorical_filters » categorical_filters

  • validate_id_type » id_type

  • validate_portfolio_filter » portfolio_filter

field dataset: str [Required]#

The name of the underlying dataset to use. If none is given then the configured default dataset is used.

Validated by:
  • propagate_dataset

field id_type: IdType = 'bayesid'#

The default id type to use for the universe.

Validated by:
  • propagate_dataset

  • validate_id_type

field calendar: CalendarSettings [Optional]#

The calendar settings to use for the universe.

Validated by:
  • propagate_dataset

  • validate_calendar

field categorical_filters: list[CategoricalFilterSettings] [Optional]#

Filters that determine which categorical codes to include and exclude in the universe.

Validated by:
  • check_unique_filters

  • propagate_dataset

  • validate_categorical_filters

field portfolio_filter: Annotated[str | int | PortfolioOrganizerSettings | None, Field(description='The portfolio organizer settings to use as an underlying schema of portfolios. Universe will be filtered across the superset of all portfolios.', default=None), SettingsTypeMetaData[str | int | PortfolioOrganizerSettings](references=PortfolioOrganizerSettings)] = None#

The portfolio organizer settings to use as an underlying schema of portfolios. Universe will be filtered across the superset of all portfolios.

Constraints:
  • references = <class ‘bayesline.api._src.equity.portfolio_settings.PortfolioOrganizerSettings’>

Validated by:
  • propagate_dataset

  • validate_portfolio_filter

field mcap_filter: MCapFilterSettings [Optional]#

Filters that determine which market caps to include and exclude in the universe.

Validated by:
  • propagate_dataset

property menu_type: type[UniverseSettingsMenu]#

Get the menu type for this settings object.

Returns#

type[SettingsMenuType]

The menu type for this settings object.

validator check_unique_filters list[CategoricalFilterSettings]  »  categorical_filters#
validator propagate_dataset Any  »  all fields#
validator validate_id_type Literal['bayesid', 'bayesid_core', 'ticker', 'composite_figi', 'cik', 'cusip8', 'cusip9', 'isin', 'sedol6', 'sedol7', 'proxy', 'name']  »  id_type#
validator validate_calendar CalendarSettings  »  calendar#
validator validate_categorical_filters list[CategoricalFilterSettings]  »  categorical_filters#
validator validate_portfolio_filter str | int | PortfolioOrganizerSettings | None  »  portfolio_filter#
describe(menu: UniverseSettingsMenu) str#

Describe the universe settings.

Parameters#

menuUniverseSettingsMenu

The settings menu to use to describe the settings.

Returns#

str

A description of the universe settings.