bayesline.api.equity.PortfolioHoldingsReportSettings#

pydantic model bayesline.api.equity.PortfolioHoldingsReportSettings#

Settings for a portfolio holdings report.

Show JSON schema
{
   "title": "PortfolioHoldingsReportSettings",
   "description": "Settings for a portfolio holdings report.",
   "type": "object",
   "properties": {
      "report_type": {
         "const": "portfolio_holdings",
         "default": "portfolio_holdings",
         "description": "Report type discriminator",
         "title": "Report Type",
         "type": "string"
      },
      "portfolio_hierarchy_settings": {
         "$ref": "#/$defs/PortfolioHierarchySettings"
      },
      "date_aggregation": {
         "const": "last",
         "default": "last",
         "title": "Date Aggregation",
         "type": "string"
      },
      "calendar": {
         "$ref": "#/$defs/CalendarSettings"
      },
      "currency": {
         "title": "Currency",
         "type": "string"
      },
      "unpack": {
         "default": true,
         "description": "Compatibility flag for legacy report clients. Portfolio holdings reports are always unpacked, so False is rejected.",
         "title": "Unpack",
         "type": "boolean"
      },
      "forward_fill": {
         "default": false,
         "title": "Forward Fill",
         "type": "boolean"
      }
   },
   "$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"
      },
      "PortfolioHierarchySettings": {
         "additionalProperties": false,
         "description": "Specifies portfolio hierarchies with arbitrary groupings (e.g. manager, etc.).",
         "properties": {
            "portfolio_schema": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "integer"
                  },
                  {
                     "$ref": "#/$defs/PortfolioOrganizerSettings"
                  }
               ],
               "description": "The portfolio organizer settings to use as an underlying schema of portfolios. The 'Default' schema is used by default.",
               "title": "Portfolio Schema"
            },
            "groupings": {
               "additionalProperties": {
                  "items": {
                     "type": "string"
                  },
                  "type": "array"
               },
               "title": "Groupings",
               "type": "object"
            },
            "portfolio_ids": {
               "items": {
                  "type": "string"
               },
               "title": "Portfolio Ids",
               "type": "array"
            },
            "benchmark_ids": {
               "items": {
                  "anyOf": [
                     {
                        "type": "string"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "title": "Benchmark Ids",
               "type": "array"
            },
            "auto_decompose_levels": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "maxItems": 100,
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "When provided, each ``portfolio_id`` that is a FoF parent is automatically expanded at load time into one entry per descendant path (``parent:child:...:leaf``) plus a ``parent_path:{REST}`` entry at each non-leaf level capturing what wasn't decomposed there. Path-typed inputs (containing ``:``) are left unchanged for idempotence. Only ``len(auto_decompose_levels)`` is meaningful \u2014 it sets the maximum recursion depth; the cascade emits exactly that many system grouping columns named ``bayesline/level_N``, and the element values themselves are not consumed. Deeper branches stop expanding and are emitted as bare leaves (no ``:{REST}`` sibling is added below a truncated node for its own un-emitted children); NAV is still conserved because the lookthrough math at query time descends through the full subtree. So ``auto_decompose_levels=['fund', 'strategy']`` decomposes up to two levels and emits ``bayesline/level_1`` and ``bayesline/level_2`` columns in ``groupings`` carrying the parent ids at each level. Compatible with hand-rolled ``groupings``: the cascade merges them via path-walk inheritance under their bare names (see ``auto_decompose_hierarchy`` in ``portfolio_cascade``). ``None`` disables auto-decompose; an empty list is rejected. Capped at 100 to keep recursion well below Python's default limit; real FoF hierarchies rarely exceed a handful of levels.",
               "title": "Auto Decompose Levels"
            }
         },
         "required": [
            "portfolio_schema",
            "portfolio_ids",
            "benchmark_ids"
         ],
         "title": "PortfolioHierarchySettings",
         "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"
      }
   },
   "additionalProperties": false,
   "required": [
      "portfolio_hierarchy_settings",
      "currency"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

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

  • currency (str)

  • date_aggregation (Literal['last'])

  • forward_fill (bool)

  • portfolio_hierarchy_settings (bayesline.api._src.equity.portfoliohierarchy_settings.PortfolioHierarchySettings)

  • report_type (Literal['portfolio_holdings'])

  • unpack (bool)

Validators:
  • validate_unpack » unpack

field report_type: Literal['portfolio_holdings'] = 'portfolio_holdings'#

Report type discriminator

Validated by:
  • _strip_unknown_on_load

field portfolio_hierarchy_settings: PortfolioHierarchySettings [Required]#
Validated by:
  • _strip_unknown_on_load

field date_aggregation: Literal['last'] = 'last'#
Validated by:
  • _strip_unknown_on_load

field calendar: CalendarSettings [Optional]#
Validated by:
  • _strip_unknown_on_load

field currency: str [Required]#
Validated by:
  • _strip_unknown_on_load

field unpack: bool = True#

Compatibility flag for legacy report clients. Portfolio holdings reports are always unpacked, so False is rejected.

Validated by:
  • _strip_unknown_on_load

  • validate_unpack

field forward_fill: bool = False#
Validated by:
  • _strip_unknown_on_load

validator validate_unpack bool  »  unpack#