SDKs
JavaScript/Typescript
User Methods
Balances
Transactions

Balance Transactions

It is possible to return a list of balance transactions for any given account.

This is done by calling the list method on the balance service in the SDK and passing the TradrAPI accountID you wish to get the list from, as follows:

import { BalanceTransaction } from '@tradrapi/trading-sdk';
 
const transactions: BalanceTransaction[] = await tradrApi.balances.list(1010001);

Response

The response from the list method is an array of BalanceTransaction objects, as follows:

import { BalanceOperation } from '@tradrapi/trading-sdk';
 
interface BalanceTransaction {
  /** The ID of the transaction in TradrAPI */
  balanceTransactionId: number;
  /** The ID of the account associated with the transaction */
  accountId: number;
  /** The ID of the server associated with the transaction */
  serverId: number;
  /** The ID of the group the account associated with the transaction belongs to */
  groupId: number;
  /** The ID of the trading platform the transaction was made on */
  exchangeId: number;
  /** The ID of the operation on the trading platform */
  exchangeOperationId?: string;
  /** The amount of the transaction */
  amount: number;
  /** The currency of the transaction */
  currency: string;
  /** The type of operation */
  operation: BalanceOperation;
  /** The IP address which initiated the transaction */
  ip?: string;
  /** A comment associated with the transaction */
  comment?: string;
  /** The reference ID of the transaction */
  referenceId?: string;
  /**
    * The date and time the balance transaction was created
    * @format date-time
    */
  createdAt: string;
  /**
    * The date and time the balance transaction was last updated
    * @format date-time
    */
  updatedAt?: string;
}