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"
      },
      "ffill": {
         "default": "no-ffill",
         "enum": [
            "no-ffill",
            "ffill-with-drift"
         ],
         "title": "Ffill",
         "type": "string"
      },
      "unpack": {
         "default": "no-unpack",
         "enum": [
            "no-unpack",
            "unpack"
         ],
         "title": "Unpack",
         "type": "string"
      }
   },
   "$defs": {
      "PortfolioOrganizerSettings": {
         "additionalProperties": false,
         "description": "Specifies which portfolios to enable (from different sources).\n\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": {
            "dataset": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "The name of the underlying dataset to use for price data needed to forward fill portfolios, obtain corporate actions, etc.If none is given then the configured default dataset is used.",
               "examples": [
                  "Bayesline-US"
               ],
               "title": "Dataset"
            },
            "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"
            }
         },
         "required": [
            "enabled_portfolios"
         ],
         "title": "PortfolioOrganizerSettings",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "portfolio_schema"
   ]
}

Config:
  • frozen: bool = True

  • extra: str = forbid

Fields:
  • ffill (Literal['no-ffill', 'ffill-with-drift'])

  • portfolio_schema (str | int | bayesline.api._src.equity.portfolio_settings.PortfolioOrganizerSettings)

  • unpack (Literal['no-unpack', 'unpack'])

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.

Constraints:
  • references = <class ‘bayesline.api._src.equity.portfolio_settings.PortfolioOrganizerSettings’>

Validated by:
  • validate_portfolio_schema

field ffill: Literal['no-ffill', 'ffill-with-drift'] = 'no-ffill'#
field unpack: Literal['no-unpack', 'unpack'] = 'no-unpack'#
property menu_type: type[PortfolioSettingsMenu]#

Get the menu type for this settings object.

Returns#

type[SettingsMenuType]

The menu type for this settings object.

classmethod from_source(source: str, ffill: Literal['no-ffill', 'ffill-with-drift'] = 'no-ffill', unpack: Literal['no-unpack', 'unpack'] = 'no-unpack', dataset: str | None = None) PortfolioSettings#

Create portfolio settings from a source.

Parameters#

sourcestr

The name of an upload from the portfolio uploader.

ffillLiteral[“no-ffill”, “ffill-with-drift”], default=”no-ffill”

The forward fill option.

unpackLiteral[“no-unpack”, “unpack”], default=”no-unpack”

The unpack option.

datasetstr | None, default=None

The risk dataset to use for the security master and asset returns. If None, the default dataset is used.

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.