View as Markdown

Transactions

List, create and delete transactions. The JSON:API type of each transaction names its kind and fixes its attributes and relationships.

Data model

The relationship to the instrument a transaction affects is named asset, with type asset.

Account interest transaction

account-interest-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

Bond coupon transaction

bond-coupon-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

grossAmountnumberRequired

Total coupon amount. Denominated in instrument currency.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository the instrument is held in.

Bond redemption transaction

bond-redemption-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units redeemed.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Bond trade transaction

bond-trade-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

accruedInterestnumberRequired

Interest accumulated on the bond from the latest repayment date to the transaction date. Denominated in instrument currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Cash transfer transaction

cash-transfer-transaction

A cash transfer can be an external transfer to an outside account or an internal transfer between accounts. An internal transfer is made by setting the counterparty-transaction relationship to the id of the related counterparty transaction; see Internal cash transfer.

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

counterparty-transactioncash-transfer-transaction

The linked transaction associated with this transaction.

Dividend transaction

dividend-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

commissionnumber

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid. Defaults to zero if not specified.

grossAmountnumberRequired

Total dividend amount before any deductions. Denominated in instrument currency.

taxnumberRequired

Tax charged as part of the transaction. Denominated in instrument currency.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository the instrument is held in.

Equity trade transaction

equity-trade-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Fee transaction

fee-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

categorystring

Type of fee. Possible values: custody, management, other. Default is other.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

Futures trade transaction

futures-trade-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Futures execution transaction

futures-execution-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

openingTransactiontransaction

The futures trade transaction associated with this transaction.

depositorydepository

The depository affected by the transaction.

FX forward cash settlement transaction

fx-forward-cash-settlement-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

fxForwardasset

The FX forward agreement that is being settled.

FX forward physical delivery transaction

fx-forward-physical-delivery-transaction

primaryAccountAmountnumberRequired

Amount deposited or withdrawn from the related account primaryAccount. Denominated in the currency of the primary account.

secondaryAccountAmountnumberRequired

Amount deposited or withdrawn from the related account secondaryAccount. Denominated in the currency of the secondary account.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date.

valueDatestringRequired

ISO 8601 representation of the transaction's value date.

Relationships:

primaryAccountaccount

The bank account affected by the primary currency of the FX pair.

secondaryAccountaccount

The bank account affected by the secondary currency of the FX pair.

fxForwardfx-forward-physical-delivery-asset

The FX forward agreement that is being settled.

FX spot transaction

fx-spot-transaction

commentstring

A brief text note or explanation related to the transaction.

inflowAccountAmountnumberRequired

Amount deposited to the related account inflowAccount. The amount must be positive and is denominated in the currency of the inflow account.

outflowAccountAmountnumberRequired

Amount withdrawn from the related account outflowAccount. The amount must be negative and is denominated in the currency of the outflow account.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date.

valueDatestringRequired

ISO 8601 representation of the transaction's value date.

Relationships:

inflowAccountaccount

Account to which the inflow currency of the FX pair is deposited.

outflowAccountaccount

Account from which the outflow currency of the FX pair is withdrawn.

Index-linked bond coupon transaction

index-linked-bond-coupon-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

grossAmountnumberRequired

Total coupon amount. Denominated in instrument currency.

indexFactornumberRequired

The index factor to use for the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository the instrument is held in.

Index-linked bond redemption transaction

index-linked-bond-redemption-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

indexFactornumberRequired

The index factor to use for the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units redeemed.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Index-linked bond trade transaction

index-linked-bond-trade-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

accruedInterestnumberRequired

Interest accumulated on the bond from the latest repayment date to the transaction date. Denominated in instrument currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

indexFactornumber

The index factor to use for the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Loan transaction

loan-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

interestnumber

Interest amount related to the loan. Denominated in account currency.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date.

valueDatestringRequired

ISO 8601 representation of the transaction's value date.

Relationships:

accountaccount

The bank account affected by the transaction.

loanasset

The loan instrument that the transaction belongs to.

Refund transaction

refund-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

Zero coupon bond trade transaction

zero-coupon-bond-trade-transaction

accountAmountnumberRequired

Amount deposited or withdrawn from the account. Denominated in account currency.

commissionnumberRequired

Commission charged by the bank or custodian. Denominated in account currency. A positive number means commission paid.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestringRequired

ISO 8601 representation of the transaction's trade date (end-of-day).

unitPricenumberRequired

Price per instrument unit.

unitsnumberRequired

Number of units bought or sold.

valueDatestringRequired

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships:

accountaccount

The bank account affected by the transaction.

assetasset

The instrument affected by the transaction.

depositorydepository

The depository affected by the transaction.

Other transaction

other-transaction

Listed for a transaction of any other kind, including private market fund distributions and drawdowns, which have their own types only on v3. Not accepted by POST /api/v2/transactions.

accountAmountnumber

Amount deposited or withdrawn from the account. Denominated in account currency.

commentstring

A brief text note or explanation related to the transaction.

tradeDatestring

ISO 8601 representation of the transaction's trade date (end-of-day).

valueDatestring

ISO 8601 representation of the transaction's value date (end-of-day).

Relationships: account, asset and depository, as on the types above. A private market fund distribution or drawdown carries only account.


GET/api/v2/transactions

List transactions

Fetch all transactions with a trade date within a specified period. At least one of accountId or depositoryId must be specified. A request without fromDate, without toDate or without either identifier returns 400 with the detail Missing or empty query parameter: ..., naming what is missing.

Query parameters

accountIdstring

Account identifier. Repeat the parameter to include several accounts.

depositoryIdstring

Depository identifier. Repeat the parameter to include several depositories. When both accountId and depositoryId are given, a transaction must match both.

fromDatestringRequired

First day in the time period, as yyyy-MM-dd.

toDatestringRequired

Last day in the time period, as yyyy-MM-dd.

Request
GET/api/v2/transactions
curl -G https://api.aleta.ai/api/v2/transactions \
  -H "Authorization: Bearer {access_token}" \
  -d accountId=6698ffbdda04cf5d2d55a265 \
  -d fromDate=2024-07-01 \
  -d toDate=2024-07-01
Response
{
  "data": [
    {
      "id": "66990014c5dc848e8f97c1bb",
      "type": "equity-trade-transaction",
      "attributes": {
        "accountAmount": 2961796.6,
        "comment": "Equity Sell",
        "commission": 199,
        "tradeDate": "2024-07-01",
        "unitPrice": 398,
        "units": -1000,
        "valueDate": "2024-07-01"
      },
      "relationships": {
        "account": {
          "data": { "type": "account", "id": "6698ffbdda04cf5d2d55a265" }
        },
        "asset": {
          "data": { "type": "asset", "id": "b5afc699f5e3a15556d2a00c" }
        },
        "depository": {
          "data": { "type": "depository", "id": "6698ffae47a5a2c8b2554ee8" }
        }
      }
    }
  ]
}

POST/api/v2/transactions

Create a transaction

Create a new transaction for an account. The body is a transaction resource of one of the types in the data model and returns 201 Created with the created transaction.

Accepted types: account-interest-transaction, bond-coupon-transaction, bond-redemption-transaction, bond-trade-transaction, cash-transfer-transaction, dividend-transaction, equity-trade-transaction, fee-transaction, fx-spot-transaction, index-linked-bond-coupon-transaction, index-linked-bond-redemption-transaction, index-linked-bond-trade-transaction, refund-transaction and zero-coupon-bond-trade-transaction. Any other type is a 500 with the detail An error occurred while processing your request.

Internal cash transfer

For an internal cash transfer, create each leg of the transaction separately:

  1. For the first leg, create a transaction in the same way as an external cash transfer.
  2. For the second leg, include the counterparty-transaction object in the relationships and set it to the id of the transaction created as the first leg.

When you send the request for the second leg, the transaction referenced in counterparty-transaction is updated automatically, and a counterparty-transaction object is also added to that first transaction.

Request
POST/api/v2/transactions
curl -X POST https://api.aleta.ai/api/v2/transactions \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/vnd.api+json" \
  -d '{
    "data": {
      "type": "equity-trade-transaction",
      "attributes": {
        "accountAmount": 397801,
        "comment": "Equity Sell",
        "commission": 199,
        "tradeDate": "2024-07-01",
        "unitPrice": 398,
        "units": -1000,
        "valueDate": "2024-07-01"
      },
      "relationships": {
        "account": { "data": { "type": "account", "id": "6698ffbdda04cf5d2d55a265" } },
        "asset": { "data": { "type": "asset", "id": "b5afc699f5e3a15556d2a00c" } },
        "depository": { "data": { "type": "depository", "id": "6698ffae47a5a2c8b2554ee8" } }
      }
    }
  }'
Response
{
  "data": {
    "id": "66990014c5dc848e8f97c1bb",
    "type": "equity-trade-transaction",
    "attributes": {
      "accountAmount": 397801,
      "comment": "Equity Sell",
      "commission": 199,
      "tradeDate": "2024-07-01",
      "unitPrice": 398,
      "units": -1000,
      "valueDate": "2024-07-01"
    },
    "relationships": {
      "account": {
        "data": { "type": "account", "id": "6698ffbdda04cf5d2d55a265" }
      },
      "asset": {
        "data": { "type": "asset", "id": "b5afc699f5e3a15556d2a00c" }
      },
      "depository": {
        "data": { "type": "depository", "id": "6698ffae47a5a2c8b2554ee8" }
      }
    }
  }
}

DELETE/api/v2/transactions/{transactionId}

Delete a transaction

Delete a transaction with a given transactionId. Returns 204 No Content. An identifier that is not a 24-character hexadecimal id returns 400; an unknown transaction returns 404 with the detail 'transaction' resource with ID '{transactionId}' not found.

Deleting one leg of an FX spot transaction also deletes its other leg.

Path parameters

transactionIdstringRequired

Identifier for the specific transaction that needs to be deleted.

Request
DELETE/api/v2/transactions/{transactionId}
curl -X DELETE https://api.aleta.ai/api/v2/transactions/66990014c5dc848e8f97c1bb \
  -H "Authorization: Bearer {access_token}"