Validating transactions

In order to generate holdings correctly, every transaction you upsert to a transaction portfolio must resolve to:

Manually resolving transactions

By default, LUSID operates a ‘data load first’ policy, so transactions you upsert are validated for schema adherence only. Transactions that fail to resolve are upserted but:

  • Those failing to resolve to instruments are mapped to the unknown instrument (LUID_ZZZZZZZZ). See how to manually resolve these transactions.

  • Those failing to resolve to transaction types are omitted from holdings reports. You should edit the type field of these transactions to supply a known transaction type.

Note: Alternatively, you can increase the level of validation to reject transactions that fail to resolve.

We recommend examining the metadata section of the response to every BatchUpsertTransactions API call to catch unresolved transactions, for example:

"metadata": {
  "warnings": [
    {
      "type": "TransactionTypesNotFound",
      "description": "No transaction types could be found for the listed transactions",
      "identifierType": "TransactionId",
      "identifiers": [
        "Txn-00001
      ]
    },
    {
      "type": "UnresolvedInstruments",
      "description": "No instruments could be resolved for the listed transactions",
      "identifierType": "TransactionId",
      "identifiers": [
        "Txn-00001,
        "Txn-00003"
      ]
    }
  ]
},
…

Increasing the level of validation to reject unresolved transactions

You can increase the level of validation to reject (that is, not upsert) transactions that fail to resolve either to an instrument, a transaction type, or both;

  • To reject transactions that fail to resolve to an instrument, set the ValidateInstruments system setting to True.

  • To reject transactions that fail to resolve to a transaction type, set the ValidateTransactionTypes system setting to True.

You can override system settings in the LUSID Configuration Store. See how to do this.

By default, a subsequent call to the BatchUpsertTransactions API upserts or rejects each transaction in a batch on its own merits. If you wish, you can set the SuccessMode parameter to Atomic to reject every transaction in the batch if even a single one fails validation.

Rejected transactions are listed in the failed section of a response to the BatchUpsertTransactions API:

"failed": {
  "transactionRequest-1": {
    "id": "transactionRequest-1",
    "type": "UpsertTransactionsFailure",
    "detail": "One or more problems occurred. Failures: One or more failures occurred. Instrument could not be resolved",
    "errorDetails": [
     {}
    ]
  },
  "transactionRequest-2": {
    "id": "transactionRequest-2",
    "type": "UpsertTransactionsFailure",
    "detail": "One or more problems occurred. Failures: There is no configuration for the transaction type: 'StockDeposit' from the source: '' at time: EffectiveAt: '2023-05-25T08:53:06.8455070+00:00' AsAt: 'AsAt=2023-05-25T08:53:06.6555730+00:00'",
    "errorDetails": [
      {}
    ]
  }
},
...