bayesline.api.equity.TSFactorSpec#
- pydantic model bayesline.api.equity.TSFactorSpec#
Specification for deriving a risk model with user-defined TS factors.
This spec is consumed by
derive_factor_model_with_tsfactorto build a newFactorRiskModelSettingsthat is then run as an ordinary report.The uploaded series is interpreted as the returns of an external portfolio or theme. Per-asset exposures are derived at report time by rolling regression of asset returns on the uploaded series; the resulting exposures feed a chained second-stage regression that produces the new factor’s returns alongside the existing model’s factors.
Show JSON schema
{ "title": "TSFactorSpec", "description": "Specification for deriving a risk model with user-defined TS factors.\n\nThis spec is consumed by ``derive_factor_model_with_tsfactor`` to build a new\n``FactorRiskModelSettings`` that is then run as an ordinary report.\n\nThe uploaded series is interpreted as the returns of an external portfolio\nor theme. Per-asset exposures are derived at report time by rolling\nregression of asset returns on the uploaded series; the resulting\nexposures feed a chained second-stage regression that produces the new\nfactor's returns alongside the existing model's factors.", "type": "object", "properties": { "tsfactors_source": { "description": "Name of the uploaded time-series factors dataset to draw from.", "title": "Tsfactors Source", "type": "string" }, "factor_selection": { "description": "Factors to pull from the uploaded dataset. Each becomes a custom factor in the derived risk model.", "items": { "$ref": "#/$defs/TSFactorSelection" }, "title": "Factor Selection", "type": "array" } }, "$defs": { "TSFactorSelection": { "description": "Selection of a single factor from an uploaded time-series dataset.", "properties": { "factor_name": { "description": "Name of the factor column within the uploaded dataset.", "title": "Factor Name", "type": "string" }, "display_name": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "description": "Optional display name for reports. Falls back to factor_name when omitted.", "title": "Display Name" }, "factor_group": { "default": "Thematic", "description": "Factor group label for grouping in reports.", "title": "Factor Group", "type": "string" }, "window": { "default": 252, "description": "Rolling window length (trading days) for TS-beta exposure.", "minimum": 2, "title": "Window", "type": "integer" }, "method": { "default": "huber", "description": "Rolling regression method for TS-beta exposure.", "enum": [ "ols", "huber" ], "title": "Method", "type": "string" } }, "required": [ "factor_name" ], "title": "TSFactorSelection", "type": "object" } }, "required": [ "tsfactors_source", "factor_selection" ] }
- Config:
frozen: bool = True
- Fields:
factor_selection (list[bayesline.api._src.equity.report.scenarios.TSFactorSelection])tsfactors_source (str)
- Validators:
_validate»all fields
-
field tsfactors_source:
str[Required]# Name of the uploaded time-series factors dataset to draw from.
- Validated by:
_validate
-
field factor_selection:
list[TSFactorSelection] [Required]# Factors to pull from the uploaded dataset. Each becomes a custom factor in the derived risk model.
- Validated by:
_validate