bayesline.api.equity.McapExposureReportSettings#
- pydantic model bayesline.api.equity.McapExposureReportSettings#
Settings for a market-cap-weighted exposure report.
Show JSON schema
{ "title": "McapExposureReportSettings", "description": "Settings for a market-cap-weighted exposure report.", "type": "object", "properties": { "report_type": { "const": "mcap_exposure", "default": "mcap_exposure", "description": "Report type discriminator", "title": "Report Type", "type": "string" }, "factor_model_settings": { "$ref": "#/$defs/FactorRiskModelSettings" } }, "$defs": { "CalendarSettings": { "additionalProperties": false, "description": "Calendar settings carrying exchange filters to construct calendars from.", "properties": { "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" }, "CategoricalExposureGroupSettings": { "additionalProperties": false, "description": "The settings for a categorical exposure group.\n\nCategorical exposures are exposures to a categorical variable, e.g. industry,\ncountry, etc. For example, an asset exposure may be to a single industry factor,\nand we say the exposure is to the industry category factor \"Materials\". The exposure\nitself may be continuous (e.g. not 0.0 or 1.0), and an asset may be exposed to\nmultiple industry factors (but typically not all of them). The distinction with\ncontinuous exposures is primarily in the settings that are available.", "properties": { "exposure_type": { "const": "categorical", "default": "categorical", "title": "Exposure Type", "type": "string" }, "hierarchy": { "description": "The hierarchy to use for the categorical exposures. This is either aHierarchyLevel or HierarchyGroups object. If a string is passed, the value is converted to a HierarchyLevel of that hierarchy with level=1.", "discriminator": { "mapping": { "groups": "#/$defs/HierarchyGroups", "level": "#/$defs/HierarchyLevel" }, "propertyName": "hierarchy_type" }, "examples": [ "trbc", { "hierarchy_type": "level", "level": 2, "name": "trbc" }, { "groupings": { "MyGroup1": [ "Energy" ], "MyGroup2": [ "Materials", "Chemicals" ] }, "hierarchy_type": "groups", "name": "style" } ], "oneOf": [ { "$ref": "#/$defs/HierarchyLevel" }, { "$ref": "#/$defs/HierarchyGroups" } ], "title": "Hierarchy" }, "factor_group": { "default": "", "description": "By default, the name of the factor group will be the name of the hierarchy. But we can override this by specifying an alias here.", "examples": [ "industry", "some_country_group" ], "title": "Factor Group", "type": "string" }, "include": { "anyOf": [ { "const": "All", "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "default": "All", "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the highest level is used. If 'All', all codes are included.", "examples": [ [ "3571" ], "All", [ "Materials", "1010" ], [ "Europe", "CAN" ] ], "title": "Include" }, "exclude": { "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the lowest level is used.", "examples": [ [ "3571" ], [ "Materials", "1010" ], [ "JPN" ] ], "items": { "type": "string" }, "title": "Exclude", "type": "array" } }, "required": [ "hierarchy" ], "title": "CategoricalExposureGroupSettings", "type": "object" }, "CategoricalFilterSettings": { "additionalProperties": false, "description": "Specify include and exclude filters for categorical codes.\n\nExamples of categorical codes are industries or countries. Assets are included if\nthey are part of at least one include and not part of any exclude.\n\nBy default all codes for the given hierarchy are included.", "properties": { "hierarchy": { "description": "The categorical hierarchy to use.", "examples": [ "trbc" ], "minLength": 1, "title": "Hierarchy", "type": "string" }, "include": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "const": "All", "type": "string" } ], "default": "All", "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the highest level is used. If 'All', all codes are included.", "examples": [ [ "3571" ], "All", [ "Materials", "1010" ], [ "Europe", "CAN" ] ], "title": "Include" }, "exclude": { "description": "Valid industry codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the lowest level is used.", "examples": [ [ "3571" ], [ "Materials", "1010" ], [ "JPN" ] ], "items": { "type": "string" }, "title": "Exclude", "type": "array" } }, "required": [ "hierarchy" ], "title": "CategoricalFilterSettings", "type": "object" }, "ContinuousExposureGroupSettings": { "additionalProperties": false, "description": "The settings for a continuous exposure group.\n\nContinuous exposures are exposures that are measured on a continuous scale,\ne.g. market, size, momentum, etc., and are typically available for most assets.", "properties": { "exposure_type": { "const": "continuous", "default": "continuous", "title": "Exposure Type", "type": "string" }, "hierarchy": { "description": "The hierarchy to use for the continuous exposures. This is either aHierarchyLevel or HierarchyGroups object. If a string is passed, the value is converted to a HierarchyLevel of that hierarchy with level=1.", "discriminator": { "mapping": { "groups": "#/$defs/HierarchyGroups", "level": "#/$defs/HierarchyLevel" }, "propertyName": "hierarchy_type" }, "examples": [ "market", { "hierarchy_type": "level", "level": 2, "name": "style" }, { "groupings": { "momentum": [ "mom6" ], "size": [ "size" ] }, "hierarchy_type": "groups", "name": "style" } ], "oneOf": [ { "$ref": "#/$defs/HierarchyLevel" }, { "$ref": "#/$defs/HierarchyGroups" } ], "title": "Hierarchy" }, "factor_group": { "default": "", "description": "By default, the name of the factor group will be the name of the hierarchy. But we can override this by specifying an alias here.", "examples": [ "style", "some_style_group" ], "title": "Factor Group", "type": "string" }, "include": { "anyOf": [ { "const": "All", "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "default": "All", "description": "Valid hierarchy codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the highest level is used. If 'All', all codes are included.", "examples": [ [ "momentum" ], "All", [ "Size", "value" ] ], "title": "Include" }, "exclude": { "description": "Valid hierarchy codes or labels for given hierarchy at any level. If labels are used which may be duplicated, then the code with the lowest level is used.", "examples": [ [ "momentum" ], [ "Size", "value" ] ], "items": { "type": "string" }, "title": "Exclude", "type": "array" }, "standardize_method": { "default": "none", "description": "The method to use for standardizing the exposures. If 'none', no standardization is applied. If 'equal_weighted', then the exposures are standardized with the mean and standard deviation of the estimation universe.", "enum": [ "none", "equal_weighted" ], "examples": [ "none", "equal_weighted" ], "title": "Standardize Method", "type": "string" } }, "required": [ "hierarchy" ], "title": "ContinuousExposureGroupSettings", "type": "object" }, "ExposureSettings": { "additionalProperties": false, "description": "Defines exposures as hierarchy of selected styles and substyles.", "properties": { "exposures": { "default": [], "description": "The exposures to build the factor risk model on.", "items": { "discriminator": { "mapping": { "categorical": "#/$defs/CategoricalExposureGroupSettings", "continuous": "#/$defs/ContinuousExposureGroupSettings", "interaction": "#/$defs/InteractionExposureGroupSettings", "tsbeta": "#/$defs/TSBetaExposureGroupSettings" }, "propertyName": "exposure_type" }, "oneOf": [ { "$ref": "#/$defs/ContinuousExposureGroupSettings" }, { "$ref": "#/$defs/CategoricalExposureGroupSettings" }, { "$ref": "#/$defs/TSBetaExposureGroupSettings" }, { "$ref": "#/$defs/InteractionExposureGroupSettings" } ] }, "title": "Exposures", "type": "array" } }, "title": "ExposureSettings", "type": "object" }, "FactorRiskModelSettings": { "additionalProperties": false, "description": "Define all settings needed to build a factor risk model.", "properties": { "universe": { "description": "The universe to build the factor risk model on.", "items": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "$ref": "#/$defs/UniverseSettings" } ] }, "maxItems": 1, "minItems": 1, "title": "Universe", "type": "array" }, "exposures": { "default": [ { "exposures": [] } ], "description": "The exposures to build the factor risk model on.", "items": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "$ref": "#/$defs/ExposureSettings" } ] }, "minItems": 1, "title": "Exposures", "type": "array" }, "modelconstruction": { "default": [ { "currency": "USD", "weights": "SqrtCap", "estimation_universe": null, "return_clip_bounds": [ -0.1, 0.1 ], "thin_category_shrinkage": {}, "thin_category_shrinkage_overrides": {}, "zero_sum_constraints": {}, "known_factor_map": {}, "fx_convert_returns": true } ], "description": "The model construction settings to use for the factor risk model.", "items": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "$ref": "#/$defs/ModelConstructionSettings" } ] }, "minItems": 1, "title": "Modelconstruction", "type": "array" }, "halflife_idio_vra": { "anyOf": [ { "exclusiveMinimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "The half-life for the idio adjustment. If None, no adjustment is applied.", "title": "Halflife Idio Vra" } }, "required": [ "universe" ], "title": "FactorRiskModelSettings", "type": "object" }, "Hierarchy": { "anyOf": [ { "items": { "type": "string" }, "type": "array" }, { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "type": "object" } ] }, "HierarchyGroups": { "additionalProperties": false, "description": "The hierarchy decscription for a custom nested grouping of the hierarchy.\n\nThe top level groupings will turn into factors, whereas any nested\ngroupings will be retained for other uses (e.g. risk decomposition).", "properties": { "hierarchy_type": { "const": "groups", "default": "groups", "title": "Hierarchy Type", "type": "string" }, "name": { "description": "\n The name of the hierarchy to use, e.g. 'trbc' or 'continent'.\n If it is not given then the default hierarchy will be used.\n ", "examples": [ "trbc", "continent" ], "minLength": 1, "title": "Name", "type": "string" }, "groupings": { "additionalProperties": { "$ref": "#/$defs/Hierarchy" }, "description": "\n A nested structure of groupings where the keys are the group names\n and the leaf level is a list of hierarchy codes or labels (at any level)\n to include for this group.\n ", "title": "Groupings", "type": "object" } }, "required": [ "name", "groupings" ], "title": "HierarchyGroups", "type": "object" }, "HierarchyLevel": { "additionalProperties": false, "description": "The hierarchy decscription for a level in the hierarchy.\n\nE.g. for industries specifying level `1` would\ncreate top level sector factors.", "properties": { "hierarchy_type": { "const": "level", "default": "level", "title": "Hierarchy Type", "type": "string" }, "name": { "description": "\n The name of the hierarchy to use, e.g. 'trbc' or 'continent'.\n If it is not given then the default hierarchy will be used.\n ", "examples": [ "trbc", "continent" ], "minLength": 1, "title": "Name", "type": "string" }, "level": { "default": 1, "description": "The level of the hierarchy to use, e.g. 1\n to use all level 1 names (i.e. sectors for industries or\n continents for regions) or 2 to use all level 2\n names (i.e. sub-sectors for industries and\n countries for regions).\n ", "examples": [ 1, 2 ], "minimum": 1, "title": "Level", "type": "integer" } }, "required": [ "name" ], "title": "HierarchyLevel", "type": "object" }, "InteractionExposureGroupSettings": { "additionalProperties": false, "description": "The settings for an interaction exposure group.\n\nInteraction exposures are exposures that are a combination of two or more\nexposure groups. For example, we may want to create industry-specific style factors.", "properties": { "exposure_type": { "const": "interaction", "default": "interaction", "title": "Exposure Type", "type": "string" }, "exposure_groups": { "default": [], "description": "The exposure groups to use for the Cartesian product.", "items": { "anyOf": [ { "$ref": "#/$defs/ContinuousExposureGroupSettings" }, { "$ref": "#/$defs/CategoricalExposureGroupSettings" } ] }, "minItems": 2, "title": "Exposure Groups", "type": "array" }, "factor_group": { "default": "", "description": "By default, the name of the factor group will be a concatenation of the names of the exposure groups separated by the a colon.", "examples": [ "industry:style" ], "title": "Factor Group", "type": "string" } }, "title": "InteractionExposureGroupSettings", "type": "object" }, "MCapFilterSettings": { "additionalProperties": false, "description": "Specify the lower and upper bound for the market cap filter.\n\nBy default the bounds are infinite.", "properties": { "lower": { "default": 0.0, "description": "Lower bound of the cap filter in USD.", "examples": [ 10000000000.0 ], "minimum": 0, "title": "Lower", "type": "number" }, "upper": { "default": 1e+20, "description": "Upper bound of the cap filter in USD.", "examples": [ 1000000000000.0 ], "exclusiveMinimum": 0.0, "minimum": 0, "title": "Upper", "type": "number" } }, "title": "MCapFilterSettings", "type": "object" }, "ModelConstructionSettings": { "additionalProperties": false, "description": "Defines settings to build a factor risk model.", "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" }, "estimation_universe": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "$ref": "#/$defs/UniverseSettings" }, { "type": "null" } ], "default": null, "description": "The universe settings to use for the estimation universe.", "title": "Estimation Universe" }, "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": [ { "maximum": 0, "type": "number" }, { "type": "null" } ] }, { "anyOf": [ { "minimum": 0, "type": "number" }, { "type": "null" } ] } ], "title": "Return Clip Bounds", "type": "array" }, "thin_category_shrinkage": { "additionalProperties": { "minimum": 0, "type": "number" }, "description": "Minimum effective number of assets (n_eff) for categorical factor groups. Factors with n_eff below this threshold get L2 shrinkage toward zero, with strength proportional to (threshold - n_eff). n_eff is the inverse HHI of regression-weight-scaled exposures. Keys are factor group names, values are n_eff thresholds. Interaction groups automatically inherit the threshold from their categorical parent component.", "title": "Thin Category Shrinkage", "type": "object" }, "thin_category_shrinkage_overrides": { "additionalProperties": { "minimum": 0, "type": "number" }, "description": "The shrinkage strength override for the factor risk model. The keys are the tuples of (categorical) factor groups and factor names and the values are the shrinkage penalty overrides.", "title": "Thin Category Shrinkage Overrides", "type": "object" }, "zero_sum_constraints": { "additionalProperties": { "enum": [ "none", "equal_weights", "mcap_weighted" ], "type": "string" }, "description": "Whether to apply a zero-sum constraint to the categorical exposures. If the category exposures are exhaustive and sum to one, then implicitly a dummy variable trap is present. This can be avoided by creating a constraint on the factor returns. This means the interpretation of the categorical factor returns is 'in excess of' the market. If 'none', no constraint is applied (for example if we do not have a market factor). If 'equal_weights' or 'mcap_weighted', then the categorical factor returns are constrained to sum to zero, either market-cap weighted or not. For all categorical factor groups, a value must be provided.", "examples": [ { "industry": [ "none" ] }, { "country": [ "mcap_weighted" ], "industry": [ "equal_weights" ] } ], "title": "Zero Sum Constraints", "type": "object" }, "known_factor_map": { "additionalProperties": { "type": "string" }, "description": "A mapping from tuple of factor groups and factor names (labels) to known series. These factors will have fixed returns derived from the series.", "title": "Known Factor Map", "type": "object" }, "fx_convert_returns": { "default": true, "description": "Whether to convert the asset returns to the currency of the factor model.", "title": "Fx Convert Returns", "type": "boolean" } }, "title": "ModelConstructionSettings", "type": "object" }, "PortfolioOrganizerSettings": { "additionalProperties": false, "description": "Definition of where to source portfolio data from.\n\nSpecifies which portfolios to enable (from different sources).\nDifferent sources (e.g. uploaded portfolios) can provide the same portfolio\nidentifiers. These settings allow to specify which portfolios to enable from\nwhich sources.", "properties": { "enabled_portfolios": { "anyOf": [ { "type": "string" }, { "additionalProperties": { "type": "string" }, "type": "object" } ], "description": "The enabled portfolios from different sources. The key is the portfolio ID, and the value is the source (name of the underlying portfolio service). Pass a str to reference an entire portfolio source (e.g. all portfolios from an upload).", "title": "Enabled Portfolios" }, "auxiliary_portfolios": { "additionalProperties": { "type": "string" }, "description": "Portfolios pulled in by fund-of-funds (FoF) cascade. Informational: always recomputed from ``enabled_portfolios`` plus the FoF graph at load time. Persisted as-is on save; any stale values are overwritten on the next normalize. The loader's effective enabled set is the union of ``enabled_portfolios`` and ``auxiliary_portfolios`` with user-explicit entries winning on key collision.", "title": "Auxiliary Portfolios", "type": "object" } }, "required": [ "enabled_portfolios" ], "title": "PortfolioOrganizerSettings", "type": "object" }, "RollingBetaSettings": { "description": "OLS rolling beta (univariate per factor).", "properties": { "method": { "const": "ols", "default": "ols", "title": "Method", "type": "string" }, "overlap": { "default": 5, "description": "Overlap (convolution) window for overlapped returns before beta computation.", "minimum": 1, "title": "Overlap", "type": "integer" } }, "title": "RollingBetaSettings", "type": "object" }, "RollingHuberBetaSettings": { "description": "Robust Huber rolling beta (univariate per factor, with intercept).", "properties": { "method": { "const": "huber", "default": "huber", "title": "Method", "type": "string" }, "max_iter": { "default": 10, "minimum": 1, "title": "Max Iter", "type": "integer" }, "level": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "default": null, "description": "Student t-test level for shrinking insignificant betas to zero.", "title": "Level" }, "epsilon": { "default": 1.35, "exclusiveMinimum": 0, "title": "Epsilon", "type": "number" }, "alpha": { "default": 0.0001, "minimum": 0, "title": "Alpha", "type": "number" } }, "title": "RollingHuberBetaSettings", "type": "object" }, "TSBetaExposureGroupSettings": { "additionalProperties": false, "description": "Exposure group settings for time-series beta exposures from uploaded time-series.\n\nComputes rolling betas between asset returns and uploaded factor\ntime-series at report time, without requiring a risk dataset rebuild.", "properties": { "exposure_type": { "const": "tsbeta", "default": "tsbeta", "title": "Exposure Type", "type": "string" }, "tsfactors_source": { "description": "The name of the uploaded time-series factors dataset.", "title": "Tsfactors Source", "type": "string" }, "factor_group": { "description": "The output factor group name for these exposures.", "title": "Factor Group", "type": "string" }, "include": { "anyOf": [ { "const": "All", "type": "string" }, { "items": { "type": "string" }, "type": "array" } ], "default": "All", "description": "Factor names to include from the uploaded dataset. 'All' includes all.", "title": "Include" }, "exclude": { "description": "Factor names to exclude from the uploaded dataset.", "items": { "type": "string" }, "title": "Exclude", "type": "array" }, "currency": { "default": "USD", "description": "Currency for computing asset returns.", "title": "Currency", "type": "string" }, "window": { "default": 252, "description": "Rolling window size for time-series beta computation.", "minimum": 2, "title": "Window", "type": "integer" }, "return_clip_bounds": { "default": [ null, null ], "description": "Clip asset returns to (lower, upper) before regression. None means no clip.", "maxItems": 2, "minItems": 2, "prefixItems": [ { "anyOf": [ { "type": "number" }, { "type": "null" } ] }, { "anyOf": [ { "type": "number" }, { "type": "null" } ] } ], "title": "Return Clip Bounds", "type": "array" }, "rolling_regression": { "description": "Rolling regression method for beta computation.", "discriminator": { "mapping": { "huber": "#/$defs/RollingHuberBetaSettings", "ols": "#/$defs/RollingBetaSettings" }, "propertyName": "method" }, "oneOf": [ { "$ref": "#/$defs/RollingBetaSettings" }, { "$ref": "#/$defs/RollingHuberBetaSettings" } ], "title": "Rolling Regression" }, "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 gaussianizing the exposures.", "title": "Gaussianize Maintain Zeros", "type": "boolean" } }, "required": [ "tsfactors_source", "factor_group" ], "title": "TSBetaExposureGroupSettings", "type": "object" }, "UniverseSettings": { "additionalProperties": false, "description": "Define an asset universe as a set of regional, industry and market cap filters.", "properties": { "id_type": { "default": "bayesid", "description": "The default id type to use for the universe.", "examples": [ "cusip9", "bayesid" ], "title": "Id Type", "type": "string" }, "calendar": { "$ref": "#/$defs/CalendarSettings", "description": "The calendar settings to use for the universe." }, "categorical_filters": { "description": "\n Filters that determine which categorical codes to include and exclude in the universe.\n ", "items": { "$ref": "#/$defs/CategoricalFilterSettings" }, "title": "Categorical Filters", "type": "array" }, "portfolio_filter": { "anyOf": [ { "type": "string" }, { "type": "integer" }, { "$ref": "#/$defs/PortfolioOrganizerSettings" }, { "type": "null" } ], "default": null, "description": "The portfolio organizer settings to use as an underlying schema of portfolios. Universe will be filtered across the superset of all portfolios.", "title": "Portfolio Filter" }, "mcap_filter": { "$ref": "#/$defs/MCapFilterSettings", "description": "\n Filters that determine which market caps to include and exclude in the universe.\n " } }, "title": "UniverseSettings", "type": "object" } }, "additionalProperties": false, "required": [ "factor_model_settings" ] }
- Config:
frozen: bool = True
extra: str = forbid
- Fields:
factor_model_settings (bayesline.api._src.equity.riskmodels_settings.FactorRiskModelSettings)report_type (Literal['mcap_exposure'])
- Validators:
-
field report_type:
Literal['mcap_exposure'] = 'mcap_exposure'# Report type discriminator
- Validated by:
_strip_unknown_on_load
-
field factor_model_settings:
FactorRiskModelSettings[Required]# - Validated by:
_strip_unknown_on_load