Sorting Algorithms

Sorting algorithms help you quickly identify the most active and relevant trading instruments by automatically organizing them based on price movement, volume, or user trading behavior. These lists are generated using live or historical market data via the BackOffice API. Available types:

  • High / Low – shows instruments that have reached or exceeded the current daily high or low price;

  • Gainers / Losers – displays two separate lists: instruments with the highest positive percentage change ("Gainers") and those with the largest negative change ("Losers") based on the "Change %" parameter;

  • Consensus – highlights instruments with the most Buy and most Sell activity among users, helping to identify the "hottest" (most bought) and "coldest" (most sold) instruments at the moment;

  • Top Volume – lists instruments with the highest total traded volume for the current day;

  • Historical Gainers / Losers – shows the top gainers and losers from previous trading sessions, based on historical performance;

  • Most Traded – ranks instruments by the number of executed trades, regardless of trade volume.

Get available algorithms

GET/algorithms

This API method is used to get a list of all algorithms available on this server. Algorithms can be filtered by specifying the appropriate filtration method in the request query. All available values are listed in the table below.

Query

Name
Type
Description

name

string

Name of the algorithm

status

string

Algorithm status. Several values can be specified separated by commas. Available values: 0 - Active/Running 1 - Stopped 2 - Inactive

type

string

Type of the algorythm, valid values:

High / Low - 0

Gainers / Losers - 1

Consensus - 2

Top volume - 3

Historical gainer loser tops - 4

Most traded - 5

CURL (example request for Inactive = 2 algorithm type)

curl -X GET "http://sandbox.traderevolution.com:8443/proftrading/rest/algorithms?status=2" -H "accept: application/json" -H "Authorization: Bearer eyIxMDQ3OTQ5Mjg0IjoxMDQ3OTQ5Mjg0LCItNjA2MTY0Mjg2IjotNjA2MTY0Mjg2LCI2MTI5NjI0NzciOjYxMjk2MjQ3NywiOTQ2NDkzNzc5Ijo5NDY0OTM3N...mM4BGDOhYLIVO5qbFG01RrG8_h3sSmTb8pZjR_dzkZiR1eAdxZLsY4AgAA.VC6bFF0oHmns38wFUHkTAb6H5mz77Gj6LG97JExcr-U"

Response

The filtered response contains one algorithm with status=2 (Inactive). The response contains the list of algorithms with details such as id, algorithmType, name, and status. All standard errors can be returned for this method as well.

Create algorithm

POST /algorithms

This method is used to create a new algorithm on the server. Various parameters can be configured here, which will be applied to the newly created algorithm.

Body

Name
Type
Description

name

string

Name of the algorithm

algorithmType

integer

Algorithm type: High / Low - 0

Gainers / Losers - 1

Consensus - 2

Top volume - 3

Historical gainer loser tops - 4

Most traded - 5

comment

string

Text definition of the algorithm

nodes

integer

The choice of the algorithmic node on which the algorithm should work

paramsList

string

An array of algorithm parameters. Each element of the array is an object that characterizes an algorithm parameter. Each object is described by the name of the algorithm and the value of the parameter

CURL

The full list of additionalProps for each algorithm type can be found by using the GET/algorithms/types/{typeId} method.

Response

In the response, you will receive the ID of the newly created algorithm along with its name.

Patch algorithm

PATCH/algorithms/{algorithmId}

This method is used to update an algorithm on the server. It requires the ID of the algorithm in the request path and parameters for the algorithm update in the body (same parameters as for POST).

Path/Body

Name
Type
Description

id

integer/path

ID of the algorithm to be modified

name

string/body

Name of the algorithm

algorithmType

integer/body

Algorithm type: High / Low - 0

Gainers / Losers - 1

Consensus - 2

Top volume - 3

Historical gainer loser tops - 4

Most traded - 5

comment

string/body

Text definition of the algorithm

nodes

integer/body

The choice of the algorithmic node on which the algorithm should work

paramsList

string/body

An array of algorithm parameters. Each element of the array is an object that characterizes an algorithm parameter. Each object is described by the name of the algorithm and the value of the parameter

CURL

The full list of additionalProps for each algorithm type can be found by using the GET/algorithms/types/{typeId} method.

Response

In the response, the 200 OK status will be received and the algorithm parameters will be updated on the server.

Delete algorithm

DELETE/algorithms/{id}

This method is used to remove the algorithm from the server. It requires only one path parameter - the ID of the algorithm that needs to be removed.

Path

Name
Type
Description

id

integer

ID of the algorithm to be deleted

CURL

Response

In the response, you will receive the 200 OK status whisc indicates the successful deletion of the algorithm.

Last updated