bayesline.api.equity.BasketFactorScenario

bayesline.api.equity.BasketFactorScenario#

pydantic model bayesline.api.equity.BasketFactorScenario#

Scenario definition for user-defined thematic basket factors.

Each basket becomes an additional custom factor in the risk model for the scope of the scenario. Initial version is equal-weighted per-basket; custom weights are supported by the Basket model but the GUI exposes equal-weighted baskets only for v1.

Show JSON schema
{
   "title": "BasketFactorScenario",
   "description": "Scenario definition for user-defined thematic basket factors.\n\nEach basket becomes an additional custom factor in the risk model for the\nscope of the scenario. Initial version is equal-weighted per-basket;\ncustom weights are supported by the Basket model but the GUI exposes\nequal-weighted baskets only for v1.",
   "type": "object",
   "properties": {
      "type": {
         "const": "basket_factor",
         "default": "basket_factor",
         "title": "Type",
         "type": "string"
      },
      "baskets": {
         "description": "List of baskets; each becomes a custom thematic factor.",
         "items": {
            "$ref": "#/$defs/Basket"
         },
         "title": "Baskets",
         "type": "array"
      }
   },
   "$defs": {
      "Basket": {
         "description": "A user-defined basket of assets that behaves as a thematic factor.\n\nThe basket's return stream becomes a custom factor in the risk model for\nthe scope of the scenario. Weights default to equal-weighted (None);\nexplicit per-asset weights are an optional forward-compatible extension.",
         "properties": {
            "name": {
               "description": "Human-readable basket name, e.g. 'AI'.",
               "title": "Name",
               "type": "string"
            },
            "asset_ids": {
               "description": "Asset IDs that make up the basket.",
               "items": {
                  "type": "string"
               },
               "title": "Asset Ids",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "type": "number"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional per-asset weights. If omitted, the basket is treated as equal-weighted. If provided, length must match asset_ids and entries must sum to approximately 1.0.",
               "title": "Weights"
            }
         },
         "required": [
            "name",
            "asset_ids"
         ],
         "title": "Basket",
         "type": "object"
      }
   },
   "required": [
      "baskets"
   ]
}

Config:
  • frozen: bool = True

Fields:
  • baskets (list[bayesline.api._src.equity.report.scenarios.Basket])

  • type (Literal['basket_factor'])

Validators:
  • _validate_unique_basket_names » all fields

field type: Literal['basket_factor'] = 'basket_factor'#
Validated by:
  • _validate_unique_basket_names

field baskets: list[Basket] [Required]#

List of baskets; each becomes a custom thematic factor.

Validated by:
  • _validate_unique_basket_names