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": true,
         "description": "Compatibility flag retained for existing clients. Holdings are always forward-filled on demand, so False is rejected.",
         "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": {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               "description": "Per-fund grouping labels keyed by grouping name, as ``{grouping: {portfolio_id: label}}``. Keys may be bare portfolio ids (``'P4'``) or ``:``-qualified subpaths (``'P3:P4'``) that label a fund only where it appears under that parent chain. A fund's label also applies to everything held inside it: when several keys apply to a row, the outermost labeled fund wins, and among keys for that fund the most qualified one wins. Empty-string labels are treated as unset, except on a key equal to a full row id, which explicitly leaves that row unlabeled. The legacy positional form (``{grouping: [one label per portfolio_ids entry]}``) is also accepted.",
               "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``: their label maps are resolved onto the expanded rows, residual entries included. ``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_forward_fill » forward_fill

  • 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 = True#

Compatibility flag retained for existing clients. Holdings are always forward-filled on demand, so False is rejected.

Validated by:
  • _strip_unknown_on_load

  • validate_forward_fill

validator validate_unpack bool  »  unpack#
validator validate_forward_fill bool  »  forward_fill#