bayesline.api.equity.ModelConstructionSettings#

pydantic model bayesline.api.equity.ModelConstructionSettings#

Defines settings to build a factor risk model.

Show JSON schema
{
   "title": "ModelConstructionSettings",
   "description": "Defines settings to build a factor risk model.",
   "type": "object",
   "properties": {
      "currency": {
         "default": "USD",
         "description": "The currency of the factor risk model.",
         "examples": [
            "USD",
            "EUR"
         ],
         "title": "Currency",
         "type": "string"
      },
      "weights": {
         "default": "SqrtCap",
         "description": "The regression weights used for the factor risk model.",
         "enum": [
            "SqrtCap",
            "InvIdioVar"
         ],
         "examples": [
            "SqrtCap",
            "InvIdioVar"
         ],
         "title": "Weights",
         "type": "string"
      },
      "alpha": {
         "default": 0.0,
         "description": "The ridge-shrinkage factor for the factor risk model.",
         "minimum": 0,
         "title": "Alpha",
         "type": "number"
      },
      "alpha_overrides": {
         "additionalProperties": {
            "minimum": 0,
            "type": "number"
         },
         "description": "The alpha override for the factor risk model. The keys are the factor names and the values are the alpha overrides.",
         "title": "Alpha Overrides",
         "type": "object"
      },
      "return_clip_bounds": {
         "default": [
            -0.1,
            0.1
         ],
         "description": "The bounds for the return clipping.",
         "examples": [
            [
               -0.1,
               0.1
            ],
            [
               null,
               null
            ]
         ],
         "maxItems": 2,
         "minItems": 2,
         "prefixItems": [
            {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ]
            },
            {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ]
            }
         ],
         "title": "Return Clip Bounds",
         "type": "array"
      },
      "known_factors": {
         "additionalProperties": {
            "type": "string"
         },
         "description": "The known factor returns to use for the factor risk model which are added as independent factors with known (constrained) values. The keys are the names that should be used in the factor model and the values are the underlying known factors that should be used. ",
         "examples": [
            {},
            {
               "Risk Free Rate": "us_rate_3m"
            }
         ],
         "title": "Known Factors",
         "type": "object"
      }
   },
   "additionalProperties": false
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • alpha (float)

  • alpha_overrides (dict[str, float])

  • currency (str)

  • known_factors (Mapping[str, str])

  • return_clip_bounds (tuple[float | None, float | None])

  • weights (Literal['SqrtCap', 'InvIdioVar'])

Validators:
  • return_clip_bounds_valid » return_clip_bounds

classmethod default() ModelConstructionSettings#
field currency: str = 'USD'#

The currency of the factor risk model.

field weights: Literal['SqrtCap', 'InvIdioVar'] = 'SqrtCap'#

The regression weights used for the factor risk model.

field alpha: Annotated[float] = 0.0#

The ridge-shrinkage factor for the factor risk model.

Constraints:
  • ge = 0

field alpha_overrides: dict[str, Annotated[float]] [Optional]#

The alpha override for the factor risk model. The keys are the factor names and the values are the alpha overrides.

field return_clip_bounds: tuple[float | None, float | None] = (-0.1, 0.1)#

The bounds for the return clipping.

Validated by:
  • return_clip_bounds_valid

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

The known factor returns to use for the factor risk model which are added as independent factors with known (constrained) values. The keys are the names that should be used in the factor model and the values are the underlying known factors that should be used.

validator return_clip_bounds_valid tuple[float | None, float | None]  »  return_clip_bounds#