bayesline.api.equity.PortfolioHierarchySettings#
- model PortfolioHierarchySettings#
Specifies portfolio hierarchies with arbitrary groupings (e.g. manager, etc.).
Fields# Field
Type
Required
Default
Constraints
No
Nonemax_length=100
Yes
No
factory
Yes
Yes
- field auto_decompose_levels: list[str] | None [Optional]#
When provided, each
portfolio_idthat is a FoF parent is automatically expanded at load time into one entry per descendant path (parent:child:...:leaf) plus aparent_path:{REST}entry at each non-leaf level capturing what wasn’t decomposed there. Path-typed inputs (containing:) are left unchanged for idempotence. Onlylen(auto_decompose_levels)is meaningful — it sets the maximum recursion depth; the cascade emits exactly that many system grouping columns namedbayesline/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. Soauto_decompose_levels=['fund', 'strategy']decomposes up to two levels and emitsbayesline/level_1andbayesline/level_2columns ingroupingscarrying the parent ids at each level; a row whose path is shorter than that carries an empty string at the tiers it does not reach. Compatible with hand-rolledgroupings: their label maps are resolved onto the expanded rows, residual entries included.Nonedisables 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.- Constraints:
max_length =
100
- field groupings: dict[str, dict[str, str]] [Optional]#
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.
- field portfolio_schema: str | int | PortfolioOrganizerSettings [Required]#
The portfolio organizer settings to use as an underlying schema of portfolios. The ‘Default’ schema is used by default.