Once created, you can update certain characteristics of an existing portfolio. Note, however, that some characteristics can only be updated in certain circumstances.
For example, you can change the display name and description of any type of portfolio at any time, but you can only change the base currency of a transaction portfolio if the latter is empty (that is, no transactions have been loaded).
To… | Portfolio type | Use the … API | Notes |
Change a portfolio's creation date, or add, change or remove an instrument scope. | Any | PatchPortfolio | The new creation date must precede the existing creation date. |
Change a portfolio's display name or description. | Any | UpdatePortfolio | |
Update one or more portfolio properties. | Any | UpsertPortfolioProperties | |
Delete one or more portfolio properties. | Any | DeletePortfolioProperties | |
For a transaction portfolio, change the base currency, collection of sub-holding keys (SHKs), transaction template scope, amortisation method, or cash gain/loss calculation date. Same for a derived transaction portfolio, except you cannot change the base currency. | Transaction, Derived transaction | PatchPortfolioDetails | To change the base currency, the transaction portfolio must be empty (no transactions loaded). To retain existing SHKs, include them in the list. |
Update a portfolio's corporate action source. | Transaction, Derived transaction | UpsertPortfolioDetails | |
Delete a derived transaction portfolio's corporate action source, instrument scope, SHKs, base currency or accounting/amortisation methods. | Derived transaction | DeleteDerivedPortfolioDetails | Resets these characteristics to those of the parent transaction portfolio. |
The Patch*
API endpoints adhere to the JSON Patch specification. Only the add
operation is currently supported.
For example, to use the PatchPortfolioDetails
API to change an empty portfolio's base currency and add a sub-holding key:
- The
value
you provide for"path": "/baseCurrency"
must be a valid ISO 4217 currency code - The
value
you provide for"path": "/subHoldingKeys"
must be the 3-stage property key of a property type that exists in theTransaction
domain. Note that existing SHKs are removed, so include them as comma-separated string values in the list to retain existing:
curl -X POST "https://<your-domain>.lusid.com/api/api/transactionportfolios/test/myemptyportfolio/details" -H "Authorization: Bearer <your-API-access-token>" -H "Content-Type: application/json-patch+json" -d '[ { "value": "JPY", "path": "/baseCurrency", "op": "add" }, { "value": [ "Transaction/Client/AccountType", "Transaction/Ibor/Strategy" ], "path": "/subHoldingKeys", "op": "add" } ]'
To use the PatchPortfolio
API to change a portfolio's creation date, the value
you provide for "path": "/creationDate"
must be an earlier date in one of these formats, for example:
curl -X POST "https://<your-domain>.lusid.com/api/api/portfolios/test/myportfolio" -H "Authorization: Bearer <your-API-access-token>" -H "Content-Type: application/json-patch+json" -d '[ { "value": "2020-01-01", "path": "/creationDate", "op": "add" } ]'
To use the PatchPortfolio
API to change the instrument scope registered with a portfolio (replaces an existing scope if one is specified):
curl -X POST "https://<your-domain>.lusid.com/api/api/portfolios/test/myportfolio" -H "Authorization: Bearer <your-API-access-token>" -H "Content-Type: application/json-patch+json" -d '[ { "value": ["my-secret-scope"], "path": "/instrumentScopes", "op": "add" } ]'