What is a transaction type calculation?

Prev Next

A calculation is an optional component of a transaction type that triggers additional functionality for all transactions belonging to that type. 

A calculation:

  • Must have a type that triggers a particular LUSID function.

  • Can have a side to pass extra information to the function.

  • Can have a formula that drives the function.

Note: The result of a calculation can be examined on an output transaction.

  • Name of type: TaxAmounts

  • Requires side: YES

  • Requires formula: NO

Calculates tax amounts due. The result is stored in the output property specified by the tax rule set. More information.

Note this calculation is ignored for a particular transaction if no tax rule set can be found to apply.

"calculations": [
  {
    "type": "TaxAmounts",
    "side": "Side1"
  }
]
JSON
  • Name of type: Txn:TradeToPortfolioRate

  • Requires side: NO

  • Requires formula: NO

Looks up an exchange rate from the transaction to the portfolio currency for the transaction date in the LUSID Quote Store. The result is stored in the Transaction/default/TradeToPortfolioRate system property. More information.

Note this calculation is ignored if Transaction/default/TradeToPortfolioRate is explicitly added to a particular transaction.

"calculations": [
  {
    "type": "Txn:TradeToPortfolioRate"
  }
]
JSON
  • Name of type: Txn:ExchangeRate

  • Requires side: NO

  • Requires formula: NO

Looks up an exchange rate from the transaction to the settlement currency for the transaction date in the LUSID Quote Store. The result is stored in the exchangeRate field. More information.

Note this calculation is ignored if exchangeRate is explicitly set on a particular transaction.

"calculations": [
  {
    "type": "Txn:ExchangeRate"
  }
]
JSON
  • Name of type: Txn:NotionalAmount

  • Requires side: NO

  • Requires formula: NO

Calculates notional amount for transactions in instruments of type Future.

For most contracts this is * * ( / ). The result is stored in the Transaction/default/NotionalAmount system property. See an example.

Note this calculation is ignored if Transaction/default/NotionalAmount is explicitly added to a particular transaction.

"calculations": [
  {
    "type": "Txn:NotionalAmount"
  }
]
JSON
  • Name of type: Txn:BondInterest

  • Requires side: NO

  • Requires formula: NO

Calculates accrued interest for transactions in instruments of type Bond, ComplexBond or InflationLinkedBond. The result is stored in the Transaction/default/BondInterest system property. See an example.

Note this calculation is ignored if Transaction/default/BondInterest is explicitly added to a particular transaction.

"calculations": [
  {
    "type": "Txn:BondInterest"
  }
]
JSON
  • Name of type: Txn:GrossConsideration

  • Requires side: NO

  • Requires formula: NO

Calculates gross consideration as total consideration before fees:

Instrument type

Calculation

Notes

Future

For transactions that reduce a position (that is, move in the opposite direction to the current holding), LUSID calculates the realised gain as follows:

notionalAmount - (notionalCost + variationMargin)

The sign of the calculated amount determines whether it is a profit (+ve) or a loss (-ve), regardless of the direction of the transaction. So for example, both Sell and CoverShort-style transactions have a positive gross consideration if there is a receipt of profit, and a negative gross consideration if there is a payment of loss. See an example.

For transactions that increase a position, LUSID sets the gross consideration to 0.

Bond, ComplexBond, InflationLinkedBond (but not MBS)

The basic calculation is:

* * * ( / )

If the transaction price type is CleanPrice or Price, bond interest is then added (this is the value of the Transaction/default/BondInterest system property).

If the type is DirtyPrice, bond interest is not added.

See an example.

MBS (modelled as special kind of ComplexBond)

The basic calculation is:

* * *

If the transaction price type is CleanPrice or Price, bond interest is then added (the value of the Transaction/default/BondInterest system property).

If the type is DirtyPrice, bond interest is not added.

See an example.

All other instrument types

The calculation is:

* * * ( / ).

The result is stored in the Transaction/default/GrossConsideration system property. Note this calculation is ignored if Transaction/default/GrossConsideration is explicitly added to a particular transaction.

"calculations": [
  {
    "type": "Txn:GrossConsideration"
  }
]
JSON
  • Name of type: DeriveTotalConsideration

  • Requires side: NO

  • Requires formula: YES

Calculates total consideration according to a user-specified formula. The result is stored in the totalConsideration.amount field on an output transaction. See an example.

Note: The totalConsideration.amount field must be set to 0 on an input transaction for this calculation to occur. It cannot be omitted. The totalConsideration.currency field can be set as normal.

For example, for transactions that increase a position you might want to calculate total consideration as gross consideration plus fees.

"calculations": [
  {
    "type": "DeriveTotalConsideration",
    "formula": "Txn:GrossConsideration + Properties[Transaction/Fees/TotalCapitalisedFees]"
  }
]
JSON

For transactions that reduce a position you might want to calculate total consideration as gross consideration minus fees.

"calculations": [
  {
    "type": "DeriveTotalConsideration",
    "formula": "Txn:GrossConsideration - Properties[Transaction/Fees/TotalCapitalisedFees]"
  }
]
JSON