How does LUSID calculate realised gain/loss?

A transaction that decreases (that is, reduces or closes) a position may realise a gain or loss.

LUSID automatically calculates a running total of holding cost from all transactions that contribute to that holding. A transaction that decreases a position reduces the total cost proportionally to the cost of the holding; note the precise impact depends upon the tax lot accounting method.

The difference between the cost reduction and the transaction’s total consideration is the realised gain/loss.

Note: The ‘total consideration’ of a transaction is a subjective concept in LUSID. You can choose whether to capitalise fees or not, include or exclude bond accrued interest, and so on.

Example: Reducing an equity position

Consider the following example, of three consecutive transactions in a single Equity instrument:

  • The first transaction is a purchase of 200 units @ 10 that establishes a holding with a unit cost of 2000 / 200 = 10.

  • The second transaction is a purchase of 500 units @ 11 that changes the unit cost to 7500 / 700 = 10.71.

  • The third transaction is a sale of 300 @ 12 that reduces holding cost proportionally (by 300 × 10.71 = 3214.29) and realises the difference to the total consideration as gain:

Transaction fields

Holding fields

transactionId

type

units

transactionPrice.price

totalConsideration.amount

cost.amount

units

Txn01

Buy

200

10

2000

2000

200

Txn02

Buy

500

11

5500

7500

700

Txn03

Sell

300

12

3600

4285.71

400

This example makes the following assumptions:

  • The containing portfolio uses the default AverageCost accounting method.

  • The transaction, settlement and portfolio currencies are all the same.

  • Both transaction types have a StockMovement that uses the built-in Side1 to convert total consideration to transaction currency (where different) and exclude bond interest (where applicable).

LUSID calculates realised gain/loss for the Sell transaction as follows:

total consideration  - (transaction units * (holding cost / holding units))

In other words:

3600 - (300 * (7500 / 700)) = 385.71

Auditing the realised gain/loss calculation for a transaction

You can examine the output transaction automatically generated by LUSID to audit a realised gain/loss calculation. Where applicable, LUSID breaks the total realised gain/loss down into market, FX and amortisation components.

To do this, call the BuildTransactions API, or navigate to Dashboard > Transactions in Output mode in the LUSID web app, select the transaction and click the ± button at the end of the row (highlighted below):

Auditing cumulative realised gain/loss for a holding

You can value a portfolio and specify the following realised P&L metrics to audit cumulative realised gain/loss over a particular period, for example year to date or from portfolio inception:

  • ProfitAndLoss/Realised/Market: Cumulative realised gain/loss from market price fluctuations.

  • ProfitAndLoss/Realised/Fx/PortfolioCcy: Cumulative realised gain/loss from exchange rate fluctuations.

  • ProfitAndLoss/Realised/Amortisation: Cumulative realised gain/loss from amortisation or accretion of bond instruments.

Note: There is no built-in metric to calculate total realised gain but you can create a custom derived valuation metric to aggregate these above.

To do this, call the GetValuation API, or navigate to Dashboard > Valuations in the LUSID web app and click the Configuration cog (highlighted below) to add realised P&L metrics to the view, for example: