Alerts

The Alerts mechanism allows users to set up notifications based on specific market conditions or price movements. This section describes the Alerts creation and management process. Possible requests are described below.

Get alerts

GET/alerts

Returns all available alerts with their IDs. Alerts can be filtered by specified parameters such as account ID, action type, instrument ID, user ID, or user login. This means you can request alerts for the required account only, etc.

Query

Name
Type
Description

accountId

string

Filter by account (using its ID).

actionType

string

Filter alerts by action type. Valid values: 0 - Place order + Notify, 1 - Notify.

userId

string

Filter by user (using its ID).

userLogin

string

Filter by user (using its login).

tradableInstrumentId

string

Filter alerts by Instrument (by its ID).

CURL

curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/alerts?accountId=679276" -H "accept: application/json" -H "Authorization: Bearer eyItMTY5MTQ4…4dKUXjSFiimZszelFwniqSizRKCOCTgWR9y-ulCCY-ypRlTD2Gs7EbVzG6FZBQlR2ohehCKZq7GGW8drJI_n7GjXSEuRYH_5DOuaVTG2EI3j6_zfkNoav39Q_eFS6QEAAA.Z8fScxB7fofh6HMePQAyJ5iud7_k7WUblGV_deQ5ydc"

Response

[
  {
    "id": 264939
  }
]

Since the account ID filter is applied to the request, in the response we can receive all alerts for the account with ID = 679276, which has one active alert. The response contains only the alert ID, its settings can be requested by using the separate GET/alerts/{alertId} request.

circle-check

Create new alert

POST /alerts

This method is used for creating a new alert on the server. Various parameters can be configured here, they will subsequently be applied to the newly created alerts. All parameters are given in the request body example below.

Body

Name
Type
Description

accountId

integer

The account for whom the alert will be created

action*

integer

Action applied after alert execution. Valid values: 0 - Place order + Notify, 1 - Notify.

afterExecute*

integer

After execute parameter of alert. Example: 0. Valid values: 0 - Stop, 1 - Remove.

alertMessage*

string

Notification text that will be sent to the user when the alert is executed.

alertType*

integer

Type of alert. Example: 0. Valid values: 0 - Ask, 1 - Bid, 2 - Last, 3 - Change%, 4 - Volume.

condition*

integer

The condition under which an alert is executed. Example: 0. Valid values: 0 - >, 1 - <, 2 - >=, 3 - <=.

expiration*

string

Expiration date of alert. Example: 1233555668

importance*

integer

Alert importance. Example: 5. Valid values: 1 - High, 5 - Medium, 10 - Low

notification*

integer

Notification type.

orderParameters*

array

Parameters of the order that will be placed by this alert. Full ist see in the request body example. Required parameters here are side, tif, and type.

routeId*

integer

ID of the route where the alert should be placed.

tradableInstrumentId*

integer

Identifier of the instrument that is used for trading purposes.

userId

integer

ID of the user.

value*

double

Alert value. Example: 100

Request body example

CURL

Response

In the response, you will simply receive the ID of the newly created alert if your operation was successful.

Remove alert

DELETE/alerts/{alertId}

This method is used to remove the alert from the server. It requires only one query parameter - the ID of the alert that should be deleted.

Path

Name
Type
Description

alertId

integer

ID of the alert that should be removed from the server.

CURL

Response

The OK (200) status is simply received in the response if your operation was successful.

Modify alert

PATCH/alerts/{alertId}

This method is used to update the alert existing on the server. It requires the ID of the alert in the path and the same request body as for the alert creation method.

Parameters

Name
Type
Description

alertId

integer/path

ID of the alert that will be updated.

body

body

The request body contains similar parameters as required for adding new alert. You can find above in this article.

CURL

Response

The OK (200) status is simply received in the response if your PATCH operation was successful.

Last updated