Accounts
Listing All Project (Brand) Accounts
It is possible to list all accounts belonging to a particular project (brand) by using the list
method under the
admin.account
namespace.
import { PaginatedResponse, AccountResult } from '@tradrapi/trading-sdk';
const result: PaginatedResponse<AccountResult> = await tradrApi.admin.account.list({ limit: 100, page: 1});
The full request object ListAccountDto
is as follows:
enum SortDir {
ASC = 'ASC',
DESC = 'DESC',
}
interface ListAccountDto {
/**
* The current page being returned.
* @default 1
*/
page?: number;
/**
* Number of records per page.
* @default 10
*/
limit?: number;
/**
* The sort direction of the records being returned
* @default "DESC"
*/
sortDir?: SortDir;
/** Specify the column by which to sort the results returned */
sortBy?: string;
/** Filter results by a specific accountId */
accountId?: number;
/** Filter results by a specific currency (ISO 4217 format) */
currency?: SupportedCurrency;
/** Filter the results by a specific trading platform ID */
exchangeAccountId?: string;
/** Filter the results by a specific account name */
accountName?: string;
/** Filter the results by a specific username */
username?: string;
}
The response object PaginatedResponse<AccountResult>
is a paginated list of AccountResult
objects. For further
information on the AccountResult
object, please see the Account section.
Deleting An Existing Account
An account can be deleted using the delete
method under the admin.account
namespace in the SDK.
const account: boolean = await tradrApi.admin.account.delete(1010000201);
Note that when an account is the account will not be usable for trading and will be deleted from the relevant platform.
If the account is a real money account then all open positions will be closed and pending orders cancelled. Please note that REAL MONEY accounts with a non-zero balance cannot be deleted.