Input and output transactions

Prev Next

For every transaction loaded into LUSID or created by the system, LUSID automatically generates and stores a corresponding output transaction:

In summary:

  • An input transaction (often just called transaction) is one loaded into LUSID using a proxy such as the REST API, SDK or web app.

  • A system-created transaction is created by LUSID in response to an instrument event or holdings adjustment.

  • An output transaction retains all the user or system data and adds extra information such as a tax calculation or realised gain/loss.

LUSID is a transaction-based system. It does not maintain a static record of your holdings in a portfolio but rather generates them on demand from the stored history of output transactions, replayed in order.

For example, consider the following economic activity impacting a particular portfolio over consecutive days:

Date

Activity

Implementation

20 May 2023

Holdings adjustment of 100 Microsoft shares

Created by LUSID in response to an AdjustHoldings API call

21 May 2023

Purchase of 50 Microsoft shares

Loaded by the user

22 May 2023

Sale of 80 Microsoft shares

Loaded by the user

23 May 2023

Microsoft cash dividend: $0.20 per share

Created by LUSID in response to a cash dividend instrument event

LUSID generates the following output transactions to represent this economic activity:

Sequence

Effective at datetime

Transaction type

Output transaction origin

1

20 May 2023 00:00:00

AdjustmentIncrease

System

2

21 May 2023 00:00:00

Buy

Input

3

22 May 2023 00:00:00

Sell

Input

4

23 May 2023 00:00:00

DividendIncome

System

When you generate a holdings report on 24 May 2023, LUSID replays these transactions in effective at datetime order to calculate that we have 70 Microsoft shares and an increase in cash.

Note: If these transactions had identical effective at datetimes then LUSID generates output transactions in a particular order, which is configurable in certain circumstances. More information.

For a particular transaction portfolio, you can see the history of:

  • Input transactions by calling the GetTransactions API. In the LUSID web app, this API drives Portfolio Management > Transactions in Input mode:
     

  • Output transactions by calling the BuildTransactions API with a particular window. In the LUSID web app, this API drives Portfolio Management > Transactions in Output mode (note this is the only way to see system-created transactions, in output transaction form):
     

  • A particular transaction by calling the GetTransactionHistory API. This might be useful if that transaction has been updated during its lifetime.

Changing the order in which certain output transactions are generated

If a set of input and system-created transactions have the same effective at datetime then LUSID generates output transactions in the following order:

  1. System-created transactions in response to instrument events.

  2. Input transactions in order of as at (that is, entry) datetime.

  3. System-created transactions in response to holdings adjustments.

Consider the same example above except this time the effective at datetimes are identical:

Sequence

Effective at datetime

As at entry datetime

Transaction type

Output transaction origin

1

20 May 2023 00:00:00

N/A

AdjustmentIncrease

System

2

20 May 2023 00:00:00

T1

Buy

Input

3

20 May 2023 00:00:00

T2

Sell

Input

4

20 May 2023 00:00:00

N/A

DividendIncome

System

LUSID generates the following output transactions to represent this economic activity:

Sequence

Effective at datetime

As at entry datetime

Transaction type

Output transaction origin

1

20 May 2023 00:00:00

T1

Buy

Input

2

20 May 2023 00:00:00

T2

Sell

Input

3

20 May 2023 00:00:00

N/A

AdjustmentIncrease

System

Note the following:

  • The DividendIncome output transaction is not generated. This is because LUSID would normally process an instrument event first, but at this point in time there is no holding in Microsoft, and so no entitlement to the dividend.

  • The Buy output transaction is generated before the Sell output transaction. This is because, by default, LUSID generates output transactions with the same effective at datetime in as at datetime order.

It is possible to determine the order in which input transactions only are generated using transaction types. So for example we could configure the Buy transaction type to have a higher transaction sequence number than the Sell transaction type, which means all Buy transactions have a lower priority than Sell transactions. See how to do this.

The result in this case would be as follows:

Sequence

Effective at datetime

As at entry datetime

Transaction type

Output transaction origin

1

20 May 2023 00:00:00

T2

Sell

Input

2

20 May 2023 00:00:00

T1

Buy

Input

3

20 May 2023 00:00:00

N/A

AdjustmentIncrease

System