How does LUSID calculate holdings from a portfolio's transactions to reflect the requirement for strategy tagging?
As documented here, LUSID's default behaviour when calculating holdings is to create them at the instrument level, i.e. all transactions for a particular instrument will contribute to a single holding. Creating sub-holding keys at the portfolio level allows for transactions to be demarcated by these keys, such that your holdings calculation will show separate "buckets" by key.
This example segregates holdings based on the investment strategy which is supplied as a property on the transactions.
- Define a transaction property to store the strategy
- Create a transaction portfolio with the property as the sub-holding key
- Upsert transactions to the portfolio including a value for the property to indicate the investment strategy
If the transactions were as follows:
- Buy 100 Instrument1 @ £10 in Strategy quantitativeSignal
- Buy 150 Instrument1 @ £20 in Strategy incomeRequirements
- Buy 50 Instrument1 @ £25 in Strategy quantitativeSignal
- Sell 50 Instrument1 @ £10 from Strategy incomeRequirements
Without any sub-holding keys specified, the holdings would be
- 250 Instrument1 @ £19
With sub-holding keys to separate holdings by the strategy
- 150 Instrument1 @ £15 in Strategy quantitativeSignal
- 100 Instrument1 @ £25 in Strategy incomeRequirements
As you can see, the quantities and costs have been segregated into separate quantitativeSignal and the incomeRequirements holdings.