bayesline.api.equity.Basket

bayesline.api.equity.Basket#

pydantic model bayesline.api.equity.Basket#

A user-defined basket of assets that behaves as a thematic factor.

The basket’s return stream becomes a custom factor in the risk model for the scope of the scenario. Weights default to equal-weighted (None); explicit per-asset weights are an optional forward-compatible extension.

Show JSON schema
{
   "title": "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.",
   "type": "object",
   "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"
   ]
}

Config:
  • frozen: bool = True

Fields:
  • asset_ids (list[str])

  • name (str)

  • weights (list[float] | None)

Validators:
  • _validate » all fields

field name: str [Required]#

Human-readable basket name, e.g. ‘AI’.

Validated by:
  • _validate

field asset_ids: list[str] [Required]#

Asset IDs that make up the basket.

Validated by:
  • _validate

field weights: list[float] | None = None#

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.

Validated by:
  • _validate