How do I add a multi-value property to an entity?

Prev Next

You can add a multi-value property to most types of entity. Adding a single-value property.

For example, you could add a Portfolio/Manager/Name property to a portfolio to record the names of all its managers.

Once added, you can update a multi-value property at any time. If you no longer need a multi-value property, you can delete it.

Using the LUSID REST API

Each entity type adheres to a specific methodology for adding multi-value properties to entities:

  • If an entity type has an Upsert* API (for example UpsertInstruments), you can add multi-value properties when you create or update entities (that is, at any time). There may be a dedicated property API that you can use independently if you want, for example UpsertInstrumentProperties.

  • If an entity type has a Create* API (for example CreatePortfolio), you can add multi-value properties when you create entities. Subsequently, you must use a dedicated property API, for example UpsertPortfolioProperties.

For example, to add a multi-value Portfolio/Manager/Name property to a transaction portfolio when you create it, call the CreatePortfolio API and append to the properties collection:

  • The key must be a 3-stage property key in the Portfolio domain.

  • The value must be a labelValueSet object consisting of a values array with a comma-separated list of string values. If the underlying property type has:

    • collectionType of Set, these values are unordered and must be unique.

    • A collectionType of Array, values are ordered and can be duplicated. More information.

  • effectiveFrom is nominally optional but for a time-variant multi-value property sets the 'start date' for all the values; it must a valid date.

curl -X POST "https://<your-domain>.lusid.com/api/api/transactionportfolios/examplescope"
-H "Authorization: Bearer <your-API-access-token>"
-H "Content-Type: application/json"
-d '{
  "displayName": "Portfolio UK",
  "code": "PortfolioUK",
  "created": "2020-01-01",
  "baseCurrency": "GBP",
  "properties": {
    "Portfolio/Manager/Name": {
      "key": "Portfolio/Manager/Name",
      "value": {
        "labelValueSet": {
          "values": [
            "Joe Bloggs",            
            "Jane Doe",
            "Matt Smith"
          ]
        }
      },
      "effectiveFrom": "2022-01-01T09:00:00.0000000+00:00" 
    }
  }
}'
portfolios_api = lusid_api_factory.build(lusid.api.TransactionPortfoliosApi)

portfolio_request = lusid.models.CreateTransactionPortfolioRequest(
    display_name="Portfolio UK",
    code="PortfolioUK",
    base_currency="GBP",
    created=datetime.datetime(2020, 1, 1, 0, 0, 0, tzinfo=datetime.timezone.utc),
    properties={
        "Portfolio/Manager/Name": lusid.models.ModelProperty(
            key="Portfolio/Manager/Name",
            value=lusid.models.PropertyValue(
                label_value_set=lusid.models.LabelValueSet(
                    values=["Joe Bloggs", "Jane Doe", "Matt Smith"]
                )
            ),
            effective_from=datetime.datetime(2022, 1, 1, 9, 0, 0, tzinfo=datetime.timezone.utc)
        )      
    }
)

try:
    portfolio_response = portfolios_api.create_portfolio(
        create_transaction_portfolio_request=portfolio_request,
        scope = "examplescope"
    )
except lusid.ApiException as e:
    print(e)

Using Luminesce

You must first ‘inline’ properties into entity providers before you can add properties to entities using Luminesce. More information.

Using the LUSID web app

You can use the LUSID web app to add a multi-value property to an entity.

For example, to add a multi-value Portfolio/Manager/Name property to a transaction portfolio:

  1. Sign in to the LUSID web app.

  2. Use the left-hand menu to navigate to Data Management > Portfolios:

  3. Select Edit on the portfolio you want to add the property to:

  4. Select Add property and choose one or more properties to add to the portfolio:

  5. Provide line-separated values for the property and save your changes: