Account management

Each user created in the system has at least one trading account assigned to it. This section describes some of the available methods for user account management.

circle-check

Get accounts list

GET/traderevolution/v1/accounts

This method is used to get the list of trading accounts available for the user with some of their settings. Please note that the user is identified by the token sent in the request so the info will be returned for this user only.

The response will contain an array of objects. Each object contains information on one account, there will be as many objects as the user has accounts. There is an “id” parameter that contains an account identifier, the value of this parameter should be used in your subsequent API calls. No additional parameters are used in this request.

CURL

curl -X GET "https://sandbox-api.traderevolution.com/traderevolution/v1/accounts" -H "accept: application/json" -H "Authorization: Bearer eyJraWQiOiI3NDhlZjYwZS1mYTNlLTRmYjAt...ANvtqQ92fTM_1EIGdm2fr4ZrL5omdKvojmrf2eR9fWSz6eZwllr-P1QvhwlG62LECoFL1kCm2gH5x_EcHV5Ff6ZwX5NDXgXL1t8MQUemeysdwIkxcM5i4YERR8s16UQ"

Response

{
  "s": "ok",
  "d": {
    "accounts": [
      {
        "id": "3243753",
        "name": "test",
        "type": "demo",
        "currency": "USD",
        "status": "ACTIVE",
        "tradingRules": {
          "supportBrackets": true,
          "supportTrailingStop": true,
          "supportPartialClosePosition": true,
          "supportSelfTrading": true,
          "supportTradingOutOfTradingHours": false
        },
        "riskRules": {
          "totalMaxPositionQty": 500,
          "maxTrailingDrawdown": 800,
          "maxPositionsNumber": 3,
          "maxPendingOrdersNumber": 60,
          "maxOrderCapital": 1500,
          "maxOrderAmount": 150,
          "dailyProfitTarget": 500,
          "maxDrawdownLevel": 1000,
          "maxOrdersCount": 500,
          "positionLossLimit": 96,
          "balanceRelativeDrawdown": 100,
          "dailyLossLimit": {
            "value": 200,
            "warnLevel1": null,
            "warnLevel2": null
          },
          "weeklyLossLimit": {
            "value": 490,
            "warnLevel1": null,
            "warnLevel2": null
          },
          "unrealizedLossLimit": {
            "value": 600,
            "warnLevel1": null,
            "warnLevel2": null
          }
        },
        "marginRules": {
          "stopOutLevel": 100,
          "marginWarningLevel": 90,
          "smaEquity": null,
          "waivedMargin": -1
        }
      }
    ]
  }
}

As a result, you will get a data object which contains an array of all user accounts with their settings (currency, risk rules, etc.). This example contains one account, with "3243563" id, "USD" currency, and "test" name. Standard errors can be received here as well. Those settings that are not configured for the account, are shown as null.

Account information (instruments, orders, positions, etc.)

This part of the API is intended to get more detailed information about the account, such as orders, positions, instruments available for the account, etc. Each request requires the accountId parameter to get information for a specific account.

Available instruments

GET/traderevolution/v1/accounts/{accountId}/instruments

This method returns a list of instruments available for trading with the specified account (accountId), i.e. a list of instruments that are visible to him. The following parameters should be added to the query.path of the request:

Query/path

Name
Type
Description

accountId*

integer/path

Account identifier.

locale

string/query

Locale (language) id.

Available values: ar, en, es, fr, ja, ko, pl, pt, ru, tr, ua, zh_sm, zh_tr

type

string/query

Symbol type. Possible values: crypto, equity, equity_cfd, etf, forex, futures, futures_cfd, indices, options, spreadbet , fund.

Note that several types can be specified using a comma as a separator.

CURL (example for Crypto type)

Response

As a result, you will get a data object that contains the instruments array, where each object contains full information about each instrument available to this particular account. As you can see from the example, only one crypto instrument is available for account:3243563.

Standard errors can be received as well. If the setting is not configured at the instrument level, the null value will be returned for it.

GET/traderevolution/v1/accounts/{accountId}/executions

This method returns all executions (order fills, trades, etc.) related to the account specified using the {accountId}. Please note that the response only contains trades that were performed in the last 24 hours.

Path/Query

Name
Type
Description

accountId*

integer/path

Identifier of the account for which executions are returned.

from

integer/query

A Unix timestamp in milliseconds (UTC) representing the start of the time range. Ignored if numberOfLines is set.

to

integer/query

A Unix timestamp in milliseconds (UTC) representing the end of the time range. Ignored if numberOfLines is set.

positionId

integer/query

Filters executions for a specific position. Ignored if numberOfLines is set.

numberOfLines

integer/query

Number of records to return. If provided, acts as a pagination limit and overrides time range filters.

Not compatible with positionId or from/to and can be used together with eventId.

eventId

integer/query

The unique identifier of the event (position update) from which the next set of data will be retrieved. Serves as a cursor for pagination to return subsequent records starting after the specified execution event. Used in combination with numberOfLines.

triangle-exclamation

CURL

Response

As a result, you will get a data object that contains the executions array, where each object contains full information about trade (Trade ID, Price, Side, Created Date (Unix timestamp), Quantity, Order ID, Position ID, Tradable Instrument ID, Instrument Name, Instrument Type, Trading Exchange, PnL, Position Status, Position Amount, Position Change, Event Trigger, Position side).

Possible Position statuses: Opened, Closed and Open (for modified positions). Possible Event trigger values: 1 - risk rule; 2 - stop loss order; 3 - take profit order; 4 - stop limit loss order; 5 - corporate action; 6 - back office manual correction; 7 - recurring investment / auto-invest; 0 - all other events.

The sequence of returned parameters is described in the Config article in more detail. All info is related to the account specified in a request.

Standard errors can be received as well.

Active orders of the account

GET/traderevolution/v1/accounts/{accountId}/orders

This method returns all active orders related to the specified account. Please note that the response contains all orders that are active during the current session and active orders from previous sessions as well.

Query/Path

Name
Type
Description

accountId*

integer/path

Identifier of the account for which active orders are returned.

from

integer/query

Unix timestamp in milliseconds (UTC) of the leftmost date (entered date is included as well). Together with to they form a range. The orders that were created in the specified range will be returned. If not specified, then all active orders are returned.

to

integer/query

Unix timestamp in milliseconds (UTC) of the rightmost date (entered date is included as well). Together with from they form a range. The orders that were created in the specified range will be returned. If not specified all active orders are returned.

tradableInstrumentId

integer/query

You can specify the instrument ID here, in case you need active orders placed for the specific instrument only.

CURL

Response

As a result, you will get a data object that contains the orders array, where each object contains full information about an order (columns: ID, Instrument ID, Qty, Side, Type, Status, Filled qty, avgPrice, Price, stopPrice, Validity, expireDate, createdDate, lastModified, isOpen, positionId, Stop loss, Stop loss type,Take profit, Take profit type, Instrument name, Instrument type, Exchange). All info is related to the account specified in a request. All time parameters are presented as the Unix timestamp. The sequence of returned parameters is described in the Config article in more detail.

Standard errors can be received as well. If some parameter is not applicable for this order (for example this order does not have filled qty yet) then it will be returned as null.

Order history by account

GET/traderevolution/v1/accounts/{accountId}/ordersHistory

This method returns order history related to the specified account. Please note that the response contains all orders that have the final status (filled, rejected, canceled, etc.).

circle-exclamation

Query/Path

Name
Type
Description

accountId*

integer/path

Identifier of the account for which the orders history is returned.

from

integer/query

Unix timestamp in milliseconds (UTC) of the leftmost date (entered date is included as well). Together with to they form a range. If not specified, then all orders are returned.

to

integer/query

Unix timestamp in milliseconds (UTC) of the rightmost date (entered date is included as well). Together with from they form a range. If not specified all orders are returned.

tradableInstrumentId

integer/query

You can specify the instrument ID here, in case you need orders for the specific instrument only.

orderId

integer/query

Filter by a specific Order ID. Only one ID filter is allowed per request.

positionId

integer/query

Filter by a specific Position ID. Only one ID filter is allowed per request.

tradeId

integer/query

Filter by a specific Trade ID. Only one ID filter is allowed per request.

CURL

Response

As a result, you will get a data object that contains the orders array, where each object contains full information about an order (columns: ID, Instrument ID, Qty, Side, Type, Status, Filled qty, avgPrice, Price, stopPrice, Validity, expireDate, createdDate, lastModified, isOpen, positionId, Stop loss, Stop loss type, Take profit, Take profit type, Instrument name, Instrument type, Exchange). All info is related to the account specified in a request. All time parameters are presented as the Unix timestamp. The sequence of returned parameters is described in the Config article in more detail.

Standard errors can be received as well. If some value is absent (for example, the Stop loss is not configured), the null value will be returned.

Positions of the account

GET/traderevolution/v1/accounts/{accountId}/positions

This method returns all positions of the specified account. Please note that the response contains all positions which are currently open.

Query/Path

Name
Type
Description

accountId*

integer/path

Identifier of the account for which the positions are returned.

tradableInstrumentId

integer/query

You can specify the instrument ID here, in case you need to find out opened positions for the specific instrument only.

CURL

Response

As a result, you will get a data object that contains the positions array, where each object contains full information about each position (columns: ID, Instrument ID, Side, Qty, avgPrice, Stop loss ID, Take profit ID, Open date, Unrealized P/L, Instrument name, Instrument type, Exchange, Stop loss, Take profit). All info is related to the account specified in a request. All time parameters are presented as the Unix timestamp. The sequence of returned parameters is described in the Config article in more detail.

Standard errors can be received as well. If some value is absent (for example, the Stop loss is not configured), the null value will be returned.

Risk rules of account

GET/traderevolution/v1/accounts/{accountId}/riskRulesCounters

This method returns the state of risk rule counters for the specified account. Please note that the response contains only current values of risk rules.

Path

Name
Type
Description

accountId*

integer

Identifier of the account for which risk rules are returned.

CURL

Response

As a result, you will get all risk rules and their values in the response. All info is related to the account specified in a request.

Standard errors can be received as well. If some value is absent (risk rule is not configured), the null value will be returned.

Account state

GET/traderevolution/v1/accounts/{accountId}/state

This method returns the current state of the specified account. Please note that the response contains various parameters that describe the current account state. All these account details can be determined using the GET/traderevolution/v1/config method, section: accountDetailsConfig (see General description of Client REST API).

Path

Name
Type
Description

accountId*

integer

Identifier of the account for which account details are returned.

CURL

Response

As a result, you will get details for the specified account (the order of the columns is the same as in the response: Balance, Projected balance, Available funds, Blocked balance, Cash balance, Unsettled cash, Withdrawal available, Stocks value, Option value, Initial margin req, Maintenance margin req, Margin warning level, Blocked for stocks, Stock orders req, Stop out level, Warning margin req, Margin before warning, Today gross, Today net, Today fees, Today volume, Today trades count, Open gross P/L, Open net P/L, Positions count, Orders count, Maintenance margin req %, Initial margin req %, Warning margin req %, Stop out value, Credit, Fixed income orders req, Blocked for fixed income, Fixed income value).

Standard errors can be received as well. If some value is absent, a 0 value will be returned.

Account statement

GET/traderevolution/v1/accounts/{accountId}/statements

This method retrieves the logs of all account operations performed by the account for either the current day, a specific time range, or based on a specified number of records. The response includes an array of headers that define the structure of the data, followed by an array of rows containing operation details. You can retrieve operations either by specifying a time range (from, optionally to) or by requesting a specific number of records (numberOfLines, optionally with operationId) to paginate through the data.

circle-exclamation

Path/Query

Name
Type
Description

accountId*

integer/path

Identifier of the account.

from

integer/query

A Unix timestamp in milliseconds (UTC) representing the start of the date range. Operations from this time/date will be included in the response.

to

integer/query

A Unix timestamp in milliseconds (UTC) representing the end of the date range. Operations up to this time/date will be included in the response.

numberOfLines

integer/query

Specifies the maximum number of records to return.

operationId

integer/query

The operation ID after which records will be returned.

CURL

Response

As a result, you will get operations for the specified account, where the columns in the dataarray correspond to the order defined in the headersarray (e.g., Account, Instrument Name, Created At, etc.).

The amount field in the response supports up to 8 decimal places to preserve full precision of financial operations, including those involving fractional values. Client applications consuming this API are responsible for applying any required formatting or rounding on their side, depending on their UI or business logic requirements.

Standard errors can be received as well.

circle-exclamation

Close account request

POST/traderevolution/v1/closeAccount

This method is intended for account closing. The method does not require any parameters, since the user account is identified by the token, which is added to the request header. Please note that using this method you can only create a request for account closing, which subsequently should be applied by the admin via BackOffice: Users -> Close account requests tab.

CURL

Response

In response, you will get an object with the account deletion request identifier - field requestId.

Standard errors can be received as well.

Closing request canceling

DELETE/traderevolution/v1/closeAccountRequests/{requestId}

This method is intended for canceling the account closing request. Note that the method requires specifying the request ID in the path (see CURL example). This ID was received after posting the account closing request.

CURL

Response

In response, you will get the “s” object only, which indicates that the request was canceled successfully - ok.

Standard errors can be received as well.

Withdrawal from account

POST/traderevolution/v1/withdrawals

This method allows you to withdraw funds from the account. Please note that the account and the amount of funds to be withdrawn are specified in the request body in this case.

Another thing is that withdrawal may need approval from the admin (depending on the Execution settings of the server), so you will only receive a withdrawal request confirmation in the response. This confirmation will be received anyway (in case of a wrong account number, empty fields, etc.), even if the request is incorrect, this is done for security purposes.

Body

Name
Type
Description

accountId

integer

Identifier of the account for which the withdrawal is performed.

amount

float

Amount of funds to be withdrawn. Both positive and negative values are allowed.

Request body example

CURL

Response

If the server accepts your request, you will receive a 200 (OK) response without parameters. Standard errors can be received as well.

Pending withdrawals

GET/traderevolution/v1/pendingWithdrawals

This method allows you to find out all withdrawals of the account that are not approved by the admin yet. Please note that the necessity of approving withdrawal requests is regulated at the Execution settings level of the server, so if the autoapprove is active, no pending withdrawals will be available.

Query

Name
Type
Description

accountId

integer

Identifier of the account for which pending withdrawals should be returned.

CURL

Response

The successful response contains the ID of the account for which there are pending withdrawals on the server, as well as the ID of the withdrawal operation and its amount.

Standard errors can be received as well.

Last updated