bayesline.api.equity.PortfolioSettings#
- pydantic model bayesline.api.equity.PortfolioSettings#
Specifies different options of obtaining portfolios.
Show JSON schema
{ "title": "PortfolioSettings", "description": "Specifies different options of obtaining portfolios.", "type": "object", "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" } }, "$defs": { "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_schema" ] }
- Config:
frozen: bool = True
extra: str = forbid
- Fields:
portfolio_schema (str | int | bayesline.api._src.equity.portfolio_settings.PortfolioOrganizerSettings)
- Validators:
validate_portfolio_schema»portfolio_schema
-
field portfolio_schema:
Annotated[str|int|PortfolioOrganizerSettings] [Required]# The portfolio organizer settings to use as an underlying schema of portfolios. The ‘Default’ schema is used by default.
- Validated by:
_strip_unknown_on_loadvalidate_portfolio_schema
- get_references() Sequence[str | int]#
Get references for this settings object.
Returns#
- Sequence[str | int]
A sequence of references (strings or integers) for this settings object.
- map_references(fn: Callable[[str | int], str | int]) Self#
Return a copy with every reference rewritten by
fn.The structural dual of
get_references(): it appliesfnto each reference this settings object holds — recursing into nested settings — and returns a rewritten copy, leaving all non-reference fields untouched. The base implementation has no references and returnsselfunchanged, mirroringget_references()(whose default is[]); a subclass that overrides one must override the other in lockstep so the two stay consistent (a parity test enforces this).fnis applied purely structurally — this object knows where its references live, not what a rewrite means. Any resolution context (e.g. a current user or a user directory) must be captured by the caller in thefnclosure; the settings layer never learns of it.Parameters#
- fnCallable[[str | int], str | int]
Applied to each reference leaf. Must preserve a reference’s kind (a name stays a name, an id stays an id).
Returns#
- Self
A copy with references rewritten.
Get the menu type for this settings object.
Returns#
- type[M]
The menu type for this settings object.
- classmethod from_source(source: str) PortfolioSettings#
Create portfolio settings from a source.
Parameters#
- sourcestr
The name of an upload from the portfolio uploader.
Returns#
- PortfolioSettings
The created portfolio settings.
- validator validate_portfolio_schema str | int | PortfolioOrganizerSettings » portfolio_schema#
- describe(menu: PortfolioSettingsMenu) str#
Describe the settings.
Parameters#
- menuPortfolioSettingsMenu
The menu to get context information from.
Returns#
- str
A description of the settings.