bayesline.api.equity.RiskDatasetHuberRegressionExposureSettings#

pydantic model bayesline.api.equity.RiskDatasetHuberRegressionExposureSettings#

Settings for Huber regression-based exposure data in a risk dataset.

This class defines settings for generating exposure data using Huber regression on time series factors, with options for windowing, regularization, and statistical testing.

Show JSON schema
{
   "title": "RiskDatasetHuberRegressionExposureSettings",
   "description": "Settings for Huber regression-based exposure data in a risk dataset.\n\nThis class defines settings for generating exposure data using Huber regression\non time series factors, with options for windowing, regularization, and statistical testing.",
   "type": "object",
   "properties": {
      "exposure_type": {
         "const": "huber_regression",
         "default": "huber_regression",
         "title": "Exposure Type",
         "type": "string"
      },
      "tsfactors_source": {
         "description": "The source of the timeseries factors.",
         "title": "Tsfactors Source",
         "type": "string"
      },
      "factor_group": {
         "default": "huber_style",
         "description": "The factor group name to use for the regression.",
         "title": "Factor Group",
         "type": "string"
      },
      "include": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "const": "All",
               "type": "string"
            }
         ],
         "default": "All",
         "description": "The factors to include in the regression.",
         "title": "Include"
      },
      "exclude": {
         "description": "The factors to exclude from the regression.",
         "items": {
            "type": "string"
         },
         "title": "Exclude",
         "type": "array"
      },
      "fill_miss": {
         "default": true,
         "title": "Fill Miss",
         "type": "boolean"
      },
      "window": {
         "default": 126,
         "description": "The window for the rolling regressions.",
         "title": "Window",
         "type": "integer"
      },
      "epsilon": {
         "default": 1.35,
         "description": "The epsilon for the huber regression.",
         "title": "Epsilon",
         "type": "number"
      },
      "alpha": {
         "default": 0.0001,
         "description": "The alpha for the huber regression.",
         "title": "Alpha",
         "type": "number"
      },
      "alpha_start": {
         "default": 10.0,
         "description": "The alpha when no data is available.",
         "title": "Alpha Start",
         "type": "number"
      },
      "student_t_level": {
         "anyOf": [
            {
               "maximum": 1.0,
               "minimum": 0.0,
               "type": "number"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "The level for the student t-test. If a test for the significance of the factor exposure is not rejected, the factor exposure is set to zero. If None, no test is run and the factor exposure is not set to zero.",
         "title": "Student T Level"
      },
      "clip": {
         "default": [
            null,
            null
         ],
         "description": "The clipping lower and upper bounds for the resulting exposures, before potential huberization.",
         "maxItems": 2,
         "minItems": 2,
         "prefixItems": [
            {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ]
            },
            {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "null"
                  }
               ]
            }
         ],
         "title": "Clip",
         "type": "array"
      },
      "gaussianize": {
         "default": true,
         "description": "Whether to gaussianize the resulting exposures.",
         "title": "Gaussianize",
         "type": "boolean"
      },
      "gaussianize_maintain_zeros": {
         "default": false,
         "description": "Whether to maintain zeros when huberizing the exposures.",
         "title": "Gaussianize Maintain Zeros",
         "type": "boolean"
      },
      "impute": {
         "default": true,
         "description": "Whether to impute missing values for the resulting exposures.",
         "title": "Impute",
         "type": "boolean"
      },
      "currency": {
         "default": "USD",
         "description": "The currency to convert all returns to.",
         "title": "Currency",
         "type": "string"
      },
      "calendar": {
         "$ref": "#/$defs/CalendarSettings",
         "description": "The calendar to use for the rolling regressions."
      }
   },
   "$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"
      }
   },
   "additionalProperties": false,
   "required": [
      "tsfactors_source"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • alpha (float)

  • alpha_start (float)

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

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

  • currency (str)

  • epsilon (float)

  • exclude (list[str])

  • exposure_type (Literal['huber_regression'])

  • factor_group (str)

  • fill_miss (bool)

  • gaussianize (bool)

  • gaussianize_maintain_zeros (bool)

  • impute (bool)

  • include (list[str] | Literal['All'])

  • student_t_level (float | None)

  • tsfactors_source (str)

  • window (int)

field exposure_type: Literal['huber_regression'] = 'huber_regression'#
field tsfactors_source: str [Required]#

The source of the timeseries factors.

field factor_group: str = 'huber_style'#

The factor group name to use for the regression.

field include: Union[list[str], Literal['All']] = 'All'#

The factors to include in the regression.

field exclude: list[str] [Optional]#

The factors to exclude from the regression.

field fill_miss: bool = True#
field window: int = 126#

The window for the rolling regressions.

field epsilon: float = 1.35#

The epsilon for the huber regression.

field alpha: float = 0.0001#

The alpha for the huber regression.

field alpha_start: float = 10.0#

The alpha when no data is available.

field student_t_level: float | None = None#

The level for the student t-test. If a test for the significance of the factor exposure is not rejected, the factor exposure is set to zero. If None, no test is run and the factor exposure is not set to zero.

Constraints:
  • ge = 0.0

  • le = 1.0

field clip: tuple[float | None, float | None] = (None, None)#

The clipping lower and upper bounds for the resulting exposures, before potential huberization.

field gaussianize: bool = True#

Whether to gaussianize the resulting exposures.

field gaussianize_maintain_zeros: bool = False#

Whether to maintain zeros when huberizing the exposures.

field impute: bool = True#

Whether to impute missing values for the resulting exposures.

field currency: str = 'USD'#

The currency to convert all returns to.

field calendar: CalendarSettings [Optional]#

The calendar to use for the rolling regressions.