CPlugin

MT5 v2 :: Trading

API v2 (current) · MT5 · 41 operations · base URL https://cloud.mywebapi.com · OpenAPI v2 (JSON) · Redoc

Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token from https://auth.cplugin.net/connect/token (scope webapi). $TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox.

Operations

Add an order

POST /api/v2/MT5/{tradePlatform}/OrderAdd

Creates an order in the trade database of the connected server. The ticket, when given, must fall inside the order ticket range of the server and be above the last used ticket; when it is omitted the server assigns the next free one. The order is stored as passed: the server checks the fields, it does not trade them. The operation is not idempotent — a repeat after an unclear outcome may add a second order with another ticket.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order (application/json) — Order fields. Fields omitted keep the defaults the server assigns to a new order.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderAdd" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }'

Add several orders

POST /api/v2/MT5/{tradePlatform}/OrderAddBatch

Adds every order of the body and answers one result code per order, at the same index as in the request. A partial failure answers the array as well, so the caller sees which orders were stored; a complete failure answers the error code only. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome may add the orders a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order[] (application/json) — Order fields, one entry per order to add.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderAddBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }]'

Add several orders (plain array form)

POST /api/v2/MT5/{tradePlatform}/OrderAddBatchArray

Same effect and same reply as the batch form: one result code per order of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome may add the orders a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order[] (application/json) — Order fields, one entry per order to add.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderAddBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }]'

Update an order

POST /api/v2/MT5/{tradePlatform}/OrderUpdate

Applies only the fields present in the body to the stored order; everything omitted keeps its current value. The order must exist and must have been created on the server this request is addressed to — any other server answers with an error instead of applying the change. The operation is not idempotent — a repeat after an unclear outcome applies the change a second time and may overwrite a newer value.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order (application/json) — Order fields to apply; the ticket identifies the order.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderUpdate" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }'

Update several orders

POST /api/v2/MT5/{tradePlatform}/OrderUpdateBatch

Applies the fields present in each entry to its stored order and answers one result code per entry, at the same index as in the request. Every order must carry its ticket and must belong to the server this request is addressed to. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order[] (application/json) — Order fields to apply, one entry per order.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderUpdateBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }]'

Update several orders (plain array form)

POST /api/v2/MT5/{tradePlatform}/OrderUpdateBatchArray

Same effect and same reply as the batch form: one result code per entry of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Order[] (application/json) — Order fields to apply, one entry per order.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderUpdateBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "order": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "symbol": "" }]'

Cancel an order

POST /api/v2/MT5/{tradePlatform}/OrderCancel/{ticket}

Moves the order to the cancelled state: it is neither executed nor triggered and no margin is held for it. The order must have been created on the server this request is addressed to; any other server answers with an error. The operation is not idempotent — a repeat after an unclear outcome is refused with the state error of the trade server, not applied twice.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Order ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderCancel/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Cancel several orders

POST /api/v2/MT5/{tradePlatform}/OrderCancelBatch

Cancels every ticket of the body and answers one result code per ticket, at the same index as in the request. A partial failure answers the array as well; a complete failure answers the error code only. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome is refused for the tickets already cancelled.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

integer (int64)[] (application/json) — Order tickets to cancel.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderCancelBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[0]'

Delete an order

POST /api/v2/MT5/{tradePlatform}/OrderDelete/{ticket}

Removes the order record from the trade database; it is not moved to history. The order must have been created on the server this request is addressed to. The operation is not idempotent — a repeat after an unclear outcome answers "not found".

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Order ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderDelete/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Open orders of an account

GET /api/v2/MT5/{tradePlatform}/OrderGetOpen/{login}

Returns the pending orders of the account that are still in the trade database, read from the server rather than from the local cache. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
login path integer (int64) yes Account login (account number).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderGetOpen/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Get an order from the server

GET /api/v2/MT5/{tradePlatform}/OrderRequest/{ticket}

Returns a single order read from the trade server, bypassing the local cache of the connection. When the ticket is unknown, the response carries the trade server's "not found" error code instead of a record.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Order ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderRequest/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Orders of several accounts, read from the server

GET /api/v2/MT5/{tradePlatform}/OrderRequestByLogins

Returns the orders of the given accounts as the trade server holds them now. The result is not paginated: the whole set is returned at once. Use the ticket-based form for a longer list than fits in the query string.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderRequestByLogins" \
  -H "Authorization: Bearer $TOKEN"

Orders of several accounts by symbol, read from the server

GET /api/v2/MT5/{tradePlatform}/OrderRequestByLoginsSymbol/{symbol}

Returns the orders of the given symbol for the given accounts as the trade server holds them now. The result is not paginated: the whole set is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name.
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderRequestByLoginsSymbol/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

Pending orders of an account, read from the server

GET /api/v2/MT5/{tradePlatform}/OrderRequestOpen/{login}

Same set as the cached read, but the trade server is asked each time, so the answer is current even when the cache of the connection is behind. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
login path integer (int64) yes Account login (account number).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/OrderRequestOpen/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Order history by group and symbol

GET /api/v2/MT5/{tradePlatform}/HistoryRequestByGroupSymbol/{mask}/{symbol}

Returns the history orders of the given symbol for every login in the groups matching the mask, within a time window. Omitted bounds mean the whole history: from 01.01.1970 to the newest record. The result is not paginated: the whole window is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
mask path string yes Group mask — one group, several comma-separated groups, or a mask with * (any value) and ! (exception), for example demo*,!demoforex.
symbol path string yes Symbol name.
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/HistoryRequestByGroupSymbol/$MASK/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

Order history of several accounts

GET /api/v2/MT5/{tradePlatform}/HistoryRequestByLogins

Returns the history orders of the given accounts within a time window. Omitted bounds mean the whole history: from 01.01.1970 to the newest record. The result is not paginated: the whole window is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/HistoryRequestByLogins" \
  -H "Authorization: Bearer $TOKEN"

Order history of several accounts by symbol

GET /api/v2/MT5/{tradePlatform}/HistoryRequestByLoginsSymbol/{symbol}

Returns the history orders of the given symbol for the given accounts within a time window. Omitted bounds mean the whole history: from 01.01.1970 to the newest record. The result is not paginated: the whole window is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name.
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/HistoryRequestByLoginsSymbol/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

One page of the order history of an account

GET /api/v2/MT5/{tradePlatform}/HistoryRequestPage/{login}

Returns a slice of the history orders of the account, read from the server. The window and the slice are given in the query; an omitted window means the whole history. The page may be shorter than total at the end of the range — walk it by adding the returned count to offset.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
login path integer (int64) yes Account login (account number).
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
offset query integer (int32) no Index of the first record of the page.
total query integer (int32) no Maximum number of records in the page.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/HistoryRequestPage/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Update a position

POST /api/v2/MT5/{tradePlatform}/PositionUpdate

Reads the stored position by its ticket and applies only the fields present in the body, so everything omitted keeps its current value. A position is identified by its ticket; the record must live on the server this request is addressed to. The operation is not idempotent — a repeat after an unclear outcome applies the change a second time and may overwrite a newer value.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Position (application/json) — Position fields to apply; position.Position identifies the position.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionUpdate" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "login": 0, "symbol": "", "action": "Buy", "digits": 0, "digitsCurrency": 0, "contractSize": 0 }'

Update several positions

POST /api/v2/MT5/{tradePlatform}/PositionUpdateBatch

Reads every stored position by its ticket, applies the fields present in each entry and answers one result code per entry, at the same index as in the request. Every entry must carry its ticket; an unknown ticket aborts the whole batch before anything is written and its error code is answered instead. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Position[] (application/json) — Position fields to apply, one entry per position.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionUpdateBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "login": 0, "symbol": "", "action": {}, "digits": 0, "digitsCurrency": 0, "contractSize": 0 }]'

Update several positions (plain array form)

POST /api/v2/MT5/{tradePlatform}/PositionUpdateBatchArray

Same effect and same reply as the batch form: one result code per entry of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Position[] (application/json) — Position fields to apply, one entry per position.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionUpdateBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "login": 0, "symbol": "", "action": {}, "digits": 0, "digitsCurrency": 0, "contractSize": 0 }]'

Split or consolidate positions

POST /api/v2/MT5/{tradePlatform}/PositionSplit

Converts the volumes and prices of the listed positions by the ratio of the request (a corporate action, for example) and answers one result code per ticket, at the same index as in the request. Omit adjustments to let the server calculate the balance adjustments itself; pass an array of zeros to skip them. A partial failure answers the array as well. The operation is not idempotent — a repeat after an unclear outcome splits the positions a second time by the same ratio.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5PositionSplitRequest (application/json) — Tickets, conversion ratio and rounding rules.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionSplit" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "tickets": [0], "adjustments": [0], "newShares": 0, "oldShares": 0, "roundRulePrice": 0, "roundRuleVolume": 0 }'

Delete a position by ticket

POST /api/v2/MT5/{tradePlatform}/PositionDeleteByTicket/{ticket}

Removes the position record from the trade database without producing a closing deal, so the account balance is not changed and may no longer add up. The position must live on the server this request is addressed to. The operation is not idempotent — a repeat after an unclear outcome answers "not found".

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Position ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionDeleteByTicket/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Open positions of a group

GET /api/v2/MT5/{tradePlatform}/PositionGetByGroup/{mask}

Returns the open positions of every login in the groups matching the mask. The result is not paginated: the whole set is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
mask path string yes Group mask — one group, several comma-separated groups, or a mask with * (any value) and ! (exception), for example demo*,!demoforex.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionGetByGroup/$MASK" \
  -H "Authorization: Bearer $TOKEN"

Get a position by ticket

GET /api/v2/MT5/{tradePlatform}/PositionGetByTicket/{ticket}

Returns a single open position by its ticket. Under the hedged accounting mode this is the only way to address a position, because one account may hold several positions in the same symbol.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Position ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionGetByTicket/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Open positions of an account, read from the server

GET /api/v2/MT5/{tradePlatform}/PositionRequest/{login}

Same set as the cached read, but the trade server is asked each time, so the answer is current even when the cache of the connection is behind. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
login path integer (int64) yes Account login (account number).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionRequest/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Open positions of a group and symbol, read from the server

GET /api/v2/MT5/{tradePlatform}/PositionRequestByGroupSymbol/{mask}/{symbol}

Returns the open positions of the given symbol for the logins in the groups matching the mask, read from the trade server. The result is not paginated: the whole set is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
mask path string yes Group mask — one group, several comma-separated groups, or a mask with * (any value) and ! (exception), for example demo*,!demoforex.
symbol path string yes Symbol name.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionRequestByGroupSymbol/$MASK/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

Open positions of several accounts, read from the server

GET /api/v2/MT5/{tradePlatform}/PositionRequestByLogins

Returns the open positions of the given accounts as the trade server holds them now. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionRequestByLogins" \
  -H "Authorization: Bearer $TOKEN"

Open positions of several accounts by symbol, read from the server

GET /api/v2/MT5/{tradePlatform}/PositionRequestByLoginsSymbol/{symbol}

Returns the open positions of the given symbol for the given accounts as the trade server holds them now. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name.
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionRequestByLoginsSymbol/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

Open positions by tickets (request body)

POST /api/v2/MT5/{tradePlatform}/PositionRequestByTickets

Returns the open positions with the given tickets, sent in the request body so a long list fits. The result is not paginated: the whole set is returned at once.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

integer (int64)[] (application/json) — Position tickets, in request-body JSON array form.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/PositionRequestByTickets" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[0]'

Add a deal

POST /api/v2/MT5/{tradePlatform}/DealAdd

Stores a deal in the trade database of the connected server without trading it: the balance of the account is not changed by the call itself, the record is simply written. The ticket, when given, must fall inside the deal ticket range of the server and be above the last used one; when omitted the server assigns the next free ticket. The operation is not idempotent — a repeat after an unclear outcome may add a second deal.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal (application/json) — Deal fields.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealAdd" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }'

Add several deals

POST /api/v2/MT5/{tradePlatform}/DealAddBatch

Adds every deal of the body and answers one result code per deal, at the same index as in the request. A partial failure answers the array as well; a complete failure answers the error code only. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome may add the deals a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deal fields, one entry per deal to add.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealAddBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Add several deals (plain array form)

POST /api/v2/MT5/{tradePlatform}/DealAddBatchArray

Same effect and same reply as the batch form: one result code per deal of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome may add the deals a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deal fields, one entry per deal to add.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealAddBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Perform a deal

POST /api/v2/MT5/{tradePlatform}/DealPerform

Executes a trade on the account: the balance and the positions change as the trade requires, which is what separates this call from storing a deal record. Login, symbol, action, volume and price are mandatory; the closing of a position under the hedged accounting mode also needs its identifier. The account must belong to the server this request is addressed to. The reply is the deal as the server stored it, with the ticket and time it assigned. The operation is not idempotent — a repeat after an unclear outcome performs the trade a second time and moves the balance twice.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal (application/json) — Deal to perform.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealPerform" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }'

Perform several deals

POST /api/v2/MT5/{tradePlatform}/DealPerformBatch

Performs every deal of the body and answers one result code per deal, at the same index as in the request. A partial failure answers the array as well; a complete failure answers the error code only. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome performs the trades a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deals to perform, one entry per deal.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealPerformBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Perform several deals (plain array form)

POST /api/v2/MT5/{tradePlatform}/DealPerformBatchArray

Same effect and same reply as the batch form: one result code per deal of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome performs the trades a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deals to perform, one entry per deal.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealPerformBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Update several deals

POST /api/v2/MT5/{tradePlatform}/DealUpdateBatch

Applies the fields present in each entry to its stored deal and answers one result code per entry, at the same index as in the request. Every entry must carry its ticket. An empty body is rejected as invalid input. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deal fields to apply, one entry per deal.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealUpdateBatch" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Update several deals (plain array form)

POST /api/v2/MT5/{tradePlatform}/DealUpdateBatchArray

Same effect and same reply as the batch form: one result code per entry of the body, at the same index. Kept because the two forms are separate operations of the trade server and differ in the shape of the array they accept. The operation is not idempotent — a repeat after an unclear outcome applies the changes a second time.

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Request body

MT5Deal[] (application/json) — Deal fields to apply, one entry per deal.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealUpdateBatchArray" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '[{ "deal": 0, "externalID": "", "login": 0, "dealer": 0, "partyID": 0, "order": 0 }]'

Delete a deal

POST /api/v2/MT5/{tradePlatform}/DealDelete/{ticket}

Removes the deal record from the trade database. The balance and the open positions are not recalculated, so the account may afterwards fail consistency checks. The deal must live on the server this request is addressed to. The operation is not idempotent — a repeat after an unclear outcome answers "not found".

Timeout: 5 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: The operation may still be completed by the server (X-Request-Outcome: unknown): check its result before repeating it.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
ticket path integer (int64) yes Deal ticket.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 5 s (trade operation). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealDelete/$TICKET" \
  -H "Authorization: Bearer $TOKEN"

Deals of several accounts by symbol

GET /api/v2/MT5/{tradePlatform}/DealRequestByLoginsSymbol/{symbol}

Returns the deals of the given symbol for the given accounts within a time window, read from the trade server. Omitted bounds mean the whole history. The result is not paginated: the whole window is returned at once.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
symbol path string yes Symbol name.
logins query integer (int64)[] no Account logins, repeated as logins=…&logins=… query parameters.
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealRequestByLoginsSymbol/$SYMBOL" \
  -H "Authorization: Bearer $TOKEN"

One page of the deal history of an account

GET /api/v2/MT5/{tradePlatform}/DealRequestPage/{login}

Returns a slice of the deals of the account, read from the server. The window and the slice are given in the query; an omitted window means the whole history. The page may be shorter than total at the end of the range — walk it by adding the returned count to offset.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform identifier (GUID).
login path integer (int64) yes Account login (account number).
from query string (date-time) no Window start; omit to start from 01.01.1970.
to query string (date-time) no Window end; omit to take everything up to the newest record.
offset query integer (int32) no Index of the first record of the page.
total query integer (int32) no Maximum number of records in the page.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/DealRequestPage/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Types the operations above take and return, with their first-level properties; * marks a required one. The full graph is in the OpenAPI specification.

MT5Order

PropertyTypeDescription
order integer (int64), nullable order ticket
externalID string, nullable order ticket in external system (exchange, ECN, etc)
login integer (int64), nullable client login
dealer integer (int64), nullable processed dealer login (0-means auto)
partyID integer (int64), nullable counterparty identification
symbol string, nullable order symbol
digits integer (int32), nullable price digits
digitsCurrency integer (int32), nullable currency digits
contractSize number (double), nullable contract size
state OrderState OrderState
reason OrderReason OrderReason
timeSetup string (date-time), nullable order setup time
timeExpiration string (date-time), nullable order expiration
timeDone string (date-time), nullable order filling/cancel time
type OrderType OrderType
typeFill OrderFilling OrderFilling
typeTime OrderTime OrderTime
priceOrder number (double), nullable order price
priceTrigger number (double), nullable order trigger price (stop-limit price)
priceCurrent number (double), nullable order current price
priceSL number (double), nullable order SL
priceTP number (double), nullable order TP
volumeInitial integer (int64), nullable order initial volume
volumeCurrent integer (int64), nullable order current volume
expertID integer (int64), nullable expert id (filled by expert advisor)
positionID integer (int64), nullable position id
comment string, nullable order comment
activationMode integer (int32), nullable Read-only: the trade server does not let this value be changed. order activation state, time and price
activationTime string (date-time), nullable Read-only: the trade server does not let this value be changed.
activationPrice number (double), nullable Read-only: the trade server does not let this value be changed. Gets the price, at which the order was activated
activationFlags TradeActivationFlags Read-only: the trade server does not let this value be changed.
timeSetupMsc string (date-time), nullable Gets and sets the order placing time in milliseconds, since 1970.01.01 If the value of this field is specified, the TimeSetup value will be filled in automatically.
timeDoneMsc string (date-time), nullable Gets and sets the order execution time in milliseconds, since 1970.01.01 If the value of this field is specified, the TimeDone value will be filled in automatically.
rateMargin number (double), nullable margin conversion rate (from symbol margin currency to deposit currency)
positionByID integer (int64), nullable position by id
modificationFlags integer (int32), nullable modification flags
volumeInitialExt integer (int64), nullable order initial volume with extended accuracy
volumeCurrentExt integer (int64), nullable order current volume with extended accuracy

BooleanApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data boolean
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5ResultListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Result[]
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5OrderListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Order[]
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5OrderApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Order
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5Position

PropertyTypeDescription
login integer (int64), nullable Gets the login of the client, to whom the trade position belongs
symbol string, nullable position symbol
action PositionActions PositionAction
digits integer (int32), nullable price digits
digitsCurrency integer (int32), nullable currency digits
contractSize number (double), nullable symbol contract size
position integer (int64), nullable position ticket
externalId string, nullable The ticket of a position in an external trading system
timeCreate string (date-time), nullable position create time
timeUpdate string (date-time), nullable position last update time
timeCreateMsc string (date-time), nullable position create time in msc since 1970.01.01 If the value of this field is specified, the TimeCreate value will be filled in automatically.
timeUpdateMsc string (date-time), nullable position last update time in msc since 1970.01.01 If the value of this field is specified, the TimeUpdate value will be filled in automatically.
priceOpen number (double), nullable position weighted average open price
priceCurrent number (double), nullable position current price
priceSL number (double), nullable position SL price
priceTP number (double), nullable position TP price
volume integer (int64), nullable position volume
volumeExt integer (int64), nullable position volume
profit number (double), nullable position floating profit
storage number (double), nullable position accumulated swaps
rateProfit number (double), nullable profit conversion rate (from symbol profit currency to deposit currency)
rateMargin number (double), nullable margin conversion rate (from symbol margin currency to deposit currency)
expertId integer (int64), nullable expert id (filled by expert advisor)
expertPositionId integer (int64), nullable expert position id
comment string, nullable
dealer integer (int64), nullable The login of a dealer, who has processed the order that opened the position. 0 means that the order was processed automatically by the server
activationMode ActivationModes order activation state, time and price
activationTime string (date-time), nullable
activationPrice number (double), nullable
activationFlags TradeActivationFlags
modificationFlags TradeModifyFlags modification flags
reason PositionReasons position reason - PositionReason

MT5PositionSplitRequest

Request body of the position split: the positions to convert, the conversion ratio and the rounding rules applied to the recalculated prices and volumes.

PropertyTypeDescription
tickets integer (int64)[] Tickets of the positions to split or consolidate. Every ticket must belong to the trade server the request is addressed to.
adjustments number (double)[] Balance adjustments, one per ticket and in the same order. Omit the whole array to let the server calculate the adjustments; send an array of zeros when no adjustment is needed.
newShares integer (int32) Number of shares after the conversion (the numerator of the ratio).
oldShares integer (int32) Number of shares before the conversion (the denominator of the ratio).
roundRulePrice integer (int32) Price rounding rule when the recalculated price has more digits than the symbol allows.
roundRuleVolume integer (int32) Volume rounding rule when the conversion leaves a fractional number of shares.
flags integer (int32) Additional split options.

MT5PositionListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Position[]
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5PositionApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Position
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5Deal

PropertyTypeDescription
deal * integer (int64) deal ticket
externalID string, nullable deal ticket in external system (exchange, ECN, etc)
login integer (int64), nullable client login
dealer integer (int64), nullable processed dealer login (0-means auto)
partyID integer (int64), nullable counterparty identification
order integer (int64), nullable deal order ticket
action DealAction DealAction
entry EntryFlag EntryFlags
digits integer (int32), nullable price digits
digitsCurrency integer (int32), nullable currency digits
contractSize number (double), nullable symbol contract size
time string (date-time), nullable deal creation datetime in seconds. If the value of this field is specified, the IMTDeal::TimeMsc value will be filled in automatically.
symbol string, nullable deal symbol
price number (double), nullable deal price
priceSL number (double), nullable order SL
priceTP number (double), nullable order TP
volume integer (int64), nullable deal volume
volumeExt integer (int64), nullable deal volume with extended accuracy
volumeClosed integer (int64), nullable closed volume
volumeClosedExt integer (int64), nullable closed volume with extended accuracy
profit number (double), nullable deal profit
value number (double), nullable value
storage number (double), nullable deal collected swaps
commission number (double), nullable deal commission
obsoleteValue number (double), nullable obsolete value
fee number (double), nullable fee
rateProfit number (double), nullable profit conversion rate (from symbol profit currency to deposit currency)
rateMargin number (double), nullable margin conversion rate (from symbol margin currency to deposit currency)
expertID integer (int64), nullable expert id (filled by expert advisor)
positionID integer (int64), nullable position id
comment string, nullable deal comment
profitRaw number (double), nullable deal profit in symbol's profit currency
pricePosition number (double), nullable closed position price
tickValue number (double), nullable tick value
tickSize number (double), nullable tick size
flags integer (int64), nullable flags
timeMsc string (date-time), nullable deal creation datetime in msc since 1970.01.01. If the value of this field is specified, the IMTDeal::Time value will be filled in automatically
reason DealReason DealReason
gateway string, nullable source gateway name
priceGateway number (double), nullable deal price on gateway
marketBid number (double), nullable Read-only: the trade server does not let this value be changed. Get the market Bid price as at the time of deal execution by the server
marketAsk number (double), nullable Read-only: the trade server does not let this value be changed. Get the market Ask price as at the time of deal execution by the server
marketLast number (double), nullable Read-only: the trade server does not let this value be changed. Get the market Last price as at the time of deal execution by the server
modificationFlags TradeModifyFlags Read-only: the trade server does not let this value be changed. modification flags

MT5DealApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Deal
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT5DealListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT5Deal[]
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

OrderState

Values: Started, Placed, Canceled, Partial, Filled, Rejected, Expired, RequestAdd, RequestModify, RequestCancel

OrderReason

Values: Client, Expert, Dealer, SL, TP, SO, Rollover, ExternalClient, VMargin, Gateway, Signal, Settlement, Transfer, Sync, ExternalService, Migration, Mobile, Web, Split, CorporateAction

OrderType

Values: Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop, BuyStopLimit, SellStopLimit, CloseBy

OrderFilling

Values: FoK, IoC, Return, BoC

OrderTime

Values: GtC, Day, Specified, SpecifiedDay

TradeActivationFlags

Flags: names of the set bits joined by ", " ("NoLimit, NoStop"), "None" when none is set; a set bit without a name is "Bit<n>" (bit number). Bits: NoLimit = 0x1, NoStop = 0x2, NoSLimit = 0x4, NoSL = 0x8, NoTP = 0x10, NoSO = 0x20, NoExpiration = 0x40. Accepted on input, never written: All = NoLimit, NoStop, NoSLimit, NoSL, NoTP, NoSO, NoExpiration.

ApiError

v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.

PropertyTypeDescription
code WebApiErrorCode Stable transport-level error code.
managerCode ResultCode Raw MT4/MT5 manager result code, when the error came from the trading platform; otherwise null.
message string, nullable Human-readable error description.

ApiMeta

Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

PropertyTypeDescription
activityId string, nullable W3C trace id of the request. Quote it when you contact support: it finds this exact call in the server logs.
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.

MT5Result

Values: Ok, OkNone, Error, ErrParams, ErrData, ErrDisk, ErrMem, ErrNetwork, ErrPermissions, ErrTimeout, ErrConnection, ErrNoService, ErrFrequent, ErrNotfound, ErrPartial, ErrShutdown, ErrCancel, ErrDuplicate, AuthClientInvalid, AuthAccountInvalid, AuthAccountDisabled, AuthAdvanced, AuthCertificate, AuthCertificateBad, AuthNotConfirmed, AuthServerInternal, AuthServerBad, AuthUpdateOnly, AuthClientOld, AuthManagerNoConfig, AuthManagerIPBlock, AuthGroupInvalid, AuthCaDisabled, AuthInvalidID, AuthInvalidIp, AuthInvalidType, AuthServerBusy, AuthServerCert, AuthAccountUnknown, AuthServerOld, AuthServerLimit, AuthMobileDisabled, AuthManagerType, AuthDemoDisabled, AuthResetPassword, AuthOTPInvalid, AuthOTPNeedSecret, AuthMigrationMT4, AuthMigrationMT5, AuthInvalidVerify, AuthVerifyBadEmail, AuthVerifyBadPhone, AuthAPIDisabled, CfgLastAdmin, CfgLastAdminGroup, CfgNotEmpty, CfgInvalidRange, CfgNotManagerLogin, CfgBuiltin, CfgDuplicate, CfgLimitReached, CfgNoAccessToMain, CfgDealerIDExist, CfgBindAddressExist, CfgWorkingTrade, CfgGatewayNameExist, CfgSwitchToBackup, CfgNoBackupModule, CfgNoTradeModule, CfgNoHistoryModule, CfgAnotherSwitch, CfgNoLicenseFile, CfgGatewayLoginExist, CfgInvalidCompany, UsrLastAdmin, UsrLoginExhausted, UsrLoginProhibited, UsrLoginExist, UsrSuicide, UsrInvalidPassword, UsrLimitReached, UsrHasTrades, UsrDifferentServers, UsrDifferentCurrency, UsrImportBalance, UsrImportGroup, UsrAccountExist, UsrImportAccount, UsrImportPositions, UsrImportOrders, UsrImportDeals, UsrImportHistory, UsrAPILimitReached, TradeLimitReached, TradeOrderExist, TradeOrderExhausted, TradeDealExhausted, TradeMaxMoney, TradeDealExist, TradeOrderProhibited, TradeDealProhibited, TradeSplitVolume, ReportSnapshot, ReportNotSupported, ReportNodata, ReportTemplateBad, ReportTemplateEnd, ReportInvalidRow, ReportLimitRepeat, ReportLimitReport, HstSymbolNotfound, RequestInWay, RequestAccepted, RequestProcess, RequestRequote, RequestPrices, RequestReject, RequestCancel, RequestPlaced, RequestDone, RequestDonePartial, RequestError, RequestTimeout, RequestInvalid, RequestInvalidVolume, RequestInvalidPrice, RequestInvalidStops, RequestTradeDisabled, RequestMarketClosed, RequestNoMoney, RequestPriceChanged, RequestPriceOff, RequestInvalidExp, RequestOrderChanged, RequestTooMany, RequestNoChanges, RequestAtDisabledServer, RequestAtDisabledClient, RequestLocked, RequestFrozen, RequestInvalidFill, RequestConnection, RequestOnlyReal, RequestLimitOrders, RequestLimitVolume, RequestInvalidOrder, RequestPositionClosed, RequestExecutionSkipped, RequestInvalidCloseVolume, RequestCloseOrderExist, RequestLimitPositions, RequestRejectCancel, RequestLongOnly, RequestShortOnly, RequestCloseOnly, RequestProhibitedByFifo, RequestHedgeProhibited, RequestReturn, RequestDoneCancel, RequestRequoteReturn, ErrNotImplement, ErrNotMain, ErrNotSupported, ErrDeadlock, ErrLocked, MessengerInvalidPhone, MessengerNotMobile, SubsNotFound, SubsNotFoundCfg, SubsNotFoundUser, SubsDisabled, SubsPermissionUser, SubsPermissionSubscribe, SubsPermissionUnsubscribe, SubsRealOnly, SubsPaymentMethod, PayRealOnly, PayInvalidAmount, PayNotAllowedDeposit, PayNotAllowedWithdrawal, PayNotAllowedGroup, PayNotAllowedCountry, PayDeclineByRules, PayDeclineByAml, PayLimitDepositMin, PayLimitDepositMax, PayLimitWithdrawalMin, PayLimitWithdrawalMax, PayProviderPayment, PayProviderStatus, PayConversion, PayNotWaiting, PayVerification, PayInvoice, PayInvalidCurrency, PayLimitReached, PayProviderRefund, PayDeclineByCardholderName

PositionActions

PositionReason

Values: Buy, Sell

ActivationModes

Values: None, SL, TP, StopOut

TradeModifyFlags

also used for Deal,Order,Position Flags: names of the set bits joined by ", " ("Admin, Manager"), "None" when none is set; a set bit without a name is "Bit<n>" (bit number). Bits: Admin = 0x1, Manager = 0x2, Position = 0x4, Restore = 0x8, ApiAdmin = 0x10, ApiManager = 0x20, ApiServer = 0x40, ApiGateway = 0x80. Accepted on input, never written: All = Admin, Manager, Position, Restore, ApiAdmin, ApiManager, ApiServer, ApiGateway.

PositionReasons

Values: Client, Expert, Dealer, SL, TP, SO, Rollover, ExternalClient, VMargin, Gateway, Signal, Settlement, Transfer, Sync, ExternalService, Migration, Mobile, Web, Split, CorporateAction

DealAction

Values: Buy, Sell, Balance, Credit, Charge, Correction, Bonus, Commission, CommissionDaily, CommissionMonthly, AgentDaily, AgentMonthly, InterestRate, BuyCanceled, SellCanceled, Dividend, DividendFranked, Tax, Agent, SOCompensation, SOCompensationCredit

EntryFlag

Values: In, Out, InOut, OutBy

DealReason

Values: Client, Expert, Dealer, Sl, Tp, So, Rollover, ExternalClient, VMargin, Gateway, Signal, Settlement, Transfer, Sync, ExternalService, Migration, Mobile, Web, Split, CorporateAction