A transaction type is one of the most important data structures in LUSID. It defines the precise economic impact of all the transactions belonging to that type on holdings.
Note the following:
A transaction must have a transaction type. If it does not, it can be stored in LUSID but has no economic impact. To ensure that transactions upserted into LUSID resolve to known transaction types, increase the level of validation.
A transaction type consists of a set of nested components: aliases, calculations, movements and sides.
A transaction type is grouped in both a source and a scope.
When you generate a holdings report for a portfolio, LUSID replays the stored history of transactions in date order and, for each, updates the quantity and/or cost of one or more holdings according to the specification in the transaction type. A holding in LUSID is thus an ephemeral object that is the aggregation of a set of transactions in an underlying instrument (for example, VOD or GBP) at a point in time.
By default, LUSID generates one holding per underlying instrument but you can split a holding into strategies using sub-holding keys (SHKs).
LUSID has a set of built-in transaction types. These are useful to get started, but we recommend creating your own universe of custom transaction types for a production system.
You can design a transaction type to have any economic impact you like. The following diagrams illustrate how the components fit together, and suggest some ways in which they might be used. For a more in-depth explanation, see this article on how LUSID uses transaction types to generate holdings.
Transfer funds into a portfolio
For each transaction, the single movement increases the core cash balance in the transaction currency by the amount transferred.
Purchase an asset
This transaction type has two movements. For each transaction:
The first movement increases the quantity of a 'stock' (that is, non-currency instrument) by the number of units purchased.
The second movement decreases the core cash balance in the transaction currency by the cost.
The built-in Buy
transaction type implements this scenario. See a detailed explanation.
Purchase an asset and account for commission
This transaction type has three movements. For each transaction:
The first movement increases the quantity of a stock by the number of units purchased.
The second movement decreases the core cash balance in the transaction currency by the cost.
The third movement maps a fee (stored as a custom property) to a SHK to break out commission as a separate cash holding.
See how to set this scenario up.