What is a transaction type calculation?

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 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.

Calculation type

Requires side?

Requires formula?

Functionality and syntax example

TaxAmounts

Yes

No

Calculates a tax amount due. Note this is ignored for a particular transaction if no tax rule can be found to apply. More information.
 

"calculations": [
  {
    "type": "TaxAmounts",
    "side": "Side1"
  }
]

Txn:TradeToPortfolioRate

No

No

Looks up an exchange rate from the transaction to the portfolio currency for the transaction date in the LUSID Quote Store. Note this is ignored for a particular transaction if the Transaction/default/TradeToPortfolioRate system property is explicitly added. More information.
 

"calculations": [
  {
    "type": "Txn:TradeToPortfolioRate"
  }
]

Txn:ExchangeRate

No

No

Looks up an exchange rate from the transaction to the settlement currency for the transaction date in the LUSID Quote Store. Note this is ignored for a particular transaction if the exchangeRate field is set. More information.
 

"calculations": [
  {
    "type": "Txn:ExchangeRate"
  }
]

Txn:GrossConsideration

No

No

Calculates gross consideration as total consideration before fees. For transactions in:

  • Instruments of type Future, this is notionalAmount - (notionalCost + variationMargin) if reducing a position. If increasing a position, the gross consideration is set to 0.

  • All other types of instrument, this is transactionPrice.price * units * exchangeRate.

Note this is ignored for a particular transaction if the Transaction/default/GrossConsideration system property is explicitly added.
 

"calculations": [
  {
    "type": "Txn:GrossConsideration"
  }
]

Txn:NotionalAmount

No

No

Calculates notional amount for transactions in instruments of type Future. Note this is ignored for a particular transaction if the Transaction/default/NotionalAmount system property is explicitly added.
 

"calculations": [
  {
    "type": "Txn:NotionalAmount"
  }
]

DeriveTotalConsideration

No

Yes

Calculates total consideration according to a formula. Note this is ignored for a particular transaction if the totalConsideration.amount field is set, and for all transactions if the total consideration system setting is disabled (more information coming soon).

For example, if increasing a position you might want to calculate total consideration as gross consideration plus fees:

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

If decreasing a position you might want to calculate total consideration as gross consideration minus fees:

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