You can tag any transaction in a transaction portfolio with a value for one or more of the sub-holding keys (SHKs) registered with that portfolio. Tags are retained throughout the investment lifecycle and workflow.
By default, LUSID reports holdings for a portfolio at the instrument level, so all transactions impacting an underlying instrument such as BP contribute to a calculation of your current position (quantity and cost) in a single BP holding. Consider the following set of transactions upserted to a portfolio:
Date | Instrument | Transaction Type | Quantity |
20 May 2023 | BP | Buy | 100 |
21 May 2023 | BP | Buy | 150 |
22 May 2023 | BP | Buy | 50 |
23 May 2023 | BP | Sell | 50 |
When you generate a holdings report after 23 May, LUSID calculates you have a single holding of 250 BP shares.
You could instead tag the same set of transactions with distinct values for an SHK representing investment strategies, for example:
Date | Instrument | Transaction Type | Quantity | Strategy |
20 May 2023 | BP | Buy | 100 | Growth |
21 May 2023 | BP | Buy | 150 | Income |
22 May 2023 | BP | Buy | 50 | Growth |
23 May 2023 | BP | Sell | 50 | Income |
This time, LUSID calculates you have two separate BP holdings, one in a Growth strategy with 150 shares and one in an Income strategy with 100 shares. For an in-depth demonstration, work through this tutorial on setting up a strategy-based transaction portfolio.
Under-the-hood, an SHK is a custom property. To tag a transaction, you must first set up the SHK, which means creating an underlying property type and registering it with the portfolio.
Then, you can add the SHK property and an appropriate value to a transaction:
- When you create that transaction using the
BatchUpsertTransactions
API. See an example. - Subsequently by updating transaction properties using the UpsertTransactionProperties API, for example for
Txn-0000001
:curl -X POST 'https://<your-domain>.lusid.com/api/api/transactionportfolios/Finbourne-Examples/Global-Equity/transactions/Txn-0000001/properties' -H 'Content-Type: application/json-patch+json' -H 'Authorization: Bearer <your-API-access-token>' -d '{ "Transaction/SHKs/Strategy": { "key": "Transaction/SHKs/Strategy", "value": { "labelValue": "Growth" } } }'
Note: Do not use
BatchUpsertTransactions
to update an existing transaction's properties, since any properties omitted from the API request are deleted rather than augmented.