CPlugin

MT5 v2 :: Market Insight

API v2 (current) · MT5 · 13 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

Read the open sessions of one account

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

Returns every live connection of the given login. A login usually holds one session, but a terminal and a mobile application connected at the same time appear as two entries with their own session identifiers.

An account that is not connected answers an empty list. The call changes nothing.

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 User 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: 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/OnlineGet/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Read the live connection list of the trade server

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

Returns the connections of every type the trade server currently holds — client terminals, mobile applications, manager terminals and API clients — except the platform's own server-to-server links, which are not part of the list.

The window is positional: from is the position it starts at and count its size. The list is live and shifts while it is read, so a repeated call may return entries that moved between pages; read the whole list in one pass when consistency matters more than the page size. total in the answer is the connection count at the moment of the request — a list shorter than total means the window ended, not that the remaining positions are empty.

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).
from query integer (int32) no Position the window starts at; the first connection when omitted.
count query integer (int32) no Window size; 100 when omitted, at most 1000.
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/OnlineRequest" \
  -H "Authorization: Bearer $TOKEN"

Disconnect a client from the trade server

POST /api/v2/MT5/{tradePlatform}/OnlineDisconnect/{login}

Drops every open session of the given login. The terminals of the account reconnect on their own afterwards, so the account appears in the connection list again within a short time unless its access is closed.

Forced disconnection is the way to make new account settings take effect at once — a terminal keeps the settings it loaded at login. The call answers true when every session of the login was dropped; a login without open sessions answers the platform "not found" error. Repeating the call is harmless.

Timeout: 15 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).
login path integer (int64) yes User 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: 15 s (change). 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/OnlineDisconnect/$LOGIN" \
  -H "Authorization: Bearer $TOKEN"

Disconnect several clients from the trade server

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

Drops every open session of every login in the body. Each login is processed on its own: the answer carries its outcome, so one login that could not be dropped does not hide the result of the others. Duplicates in the body are collapsed, and logins without open sessions are reported as "not found".

The answer is a list with one entry per requested login, in request order. The call is safe to repeat: a login that was already dropped answers "not found" and changes nothing.

Timeout: 15 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: 15 s (change). 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) — Logins of the accounts to disconnect; at most 1000 per call.

Responses

Example

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

Add a symbol to the selected-symbol list

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

The selected list decides whose price stream the manager application receives, so a symbol outside it produces no prices in the streaming feeds. The name must match the symbol exactly as the trade server holds it.

Adding a symbol that is already in the list changes nothing and answers success. Adding a name the trade server does not know fails with a platform error.

Timeout: 15 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: 15 s (change). 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

MT5SymbolRequest (application/json) — Symbol to add.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/SelectedAdd" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "symbol": "" }'

Add several symbols to the selected-symbol list

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

Adds every name in the body to the selected list in one call. The batch is applied as a whole: the platform result covers the complete list. Names already present change nothing. Repeating the call is harmless.

Timeout: 15 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: 15 s (change). 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

MT5SymbolsRequest (application/json) — Symbols to add.

Responses

Example

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

Add every available symbol to the selected-symbol list

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

Puts every symbol the manager application is allowed to see into the selected list. The call changes nothing else and is safe to repeat.

Timeout: 15 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: 15 s (change). 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/SelectedAddAll" \
  -H "Authorization: Bearer $TOKEN"

Remove a symbol from the selected-symbol list

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

Removes one symbol either by its name or by its position in the list; give exactly one of the two. Removing a symbol that is not in the list fails with a platform error.

A symbol that has open orders or open positions cannot be removed while the manager application receives orders or positions — such symbols stay in the list and the call fails with a platform error.

Timeout: 15 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: 15 s (change). 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

MT5SelectedDeleteRequest (application/json) — Symbol name or list position to remove.

Responses

Example

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

Remove several symbols from the selected-symbol list

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

Removes every name in the body in one call. Symbols with open orders or open positions stay in the list and make the platform reject the batch while the manager application receives orders or positions. Names that are not in the list are ignored.

Timeout: 15 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: 15 s (change). 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

MT5SymbolsRequest (application/json) — Symbols to remove.

Responses

Example

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

Clear the selected-symbol list

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

Removes every symbol from the selected list. Symbols with open orders or open positions stay in it while the manager application receives orders or positions, and the call then fails with a platform error. Safe to repeat.

Timeout: 15 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: 15 s (change). 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/SelectedDeleteAll" \
  -H "Authorization: Bearer $TOKEN"

Move a symbol inside the selected-symbol list

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

Changes the order of the selected list without adding or removing anything. A negative shift moves the symbol towards the top of the list, a positive one towards its end; a position or shift outside the list fails with a platform error.

Timeout: 15 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: 15 s (change). 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

MT5SelectedShiftRequest (application/json) — Position of the symbol and its offset.

Responses

Example

curl -X POST "https://cloud.mywebapi.com/api/v2/MT5/$TRADE_PLATFORM_ID/SelectedShift" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "pos": 0, "shift": 0 }'

Read the selected-symbol list

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

Returns the names in the list in list order, together with the list length at the moment of the request. The window is positional: from is the position it starts at and count its size.

This is the list whose prices the manager application receives. When the application is connected with order or position updates, the symbols that have open orders or open positions are in the list automatically.

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).
from query integer (int32) no Position the window starts at; the first symbol when omitted.
count query integer (int32) no Window size; 100 when omitted, at most 1000.
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/SelectedNext" \
  -H "Authorization: Bearer $TOKEN"

Read the Depth of Market of a symbol

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

Returns the whole Depth of Market of the symbol — every entry, not the difference from the previous state — ordered by price from the highest to the lowest. Volumes are given as the data provider supplies them, together with the extended-precision value.

The trade server delivers the Depth of Market only after the manager application has subscribed to the symbol, so the first call for a symbol subscribes to it and the subscription is kept for later calls. A symbol with the Depth of Market disabled on the server answers a platform error instead of an empty book.

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 exactly as the trade server holds it.
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/BookGet/$SYMBOL" \
  -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.

MT5OnlineListApiResponse

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 MT5Online[]
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.

MT5OnlinePageApiResponse

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 MT5OnlinePage One positional window of the live connection list, v2 read DTO.
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.

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.

MT5OnlineDisconnectResultListApiResponse

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 MT5OnlineDisconnectResult[]
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.

MT5SymbolRequest

Request body naming one symbol, v2 write DTO.

PropertyTypeDescription
symbol string, nullable Symbol name exactly as the trade server holds it.

MT5SymbolsRequest

Request body naming several symbols, v2 write DTO.

PropertyTypeDescription
symbols string[] Symbol names exactly as the trade server holds them.

MT5SelectedDeleteRequest

Request body removing one symbol from the selected list, v2 write DTO.

PropertyTypeDescription
symbol string, nullable Symbol name to remove.
pos integer (int32), nullable Position of the symbol in the list, starting from zero.

MT5SelectedShiftRequest

Request body moving one symbol inside the selected list, v2 write DTO.

PropertyTypeDescription
pos integer (int32), nullable Position of the symbol in the list, starting from zero.
shift integer (int32), nullable Offset from the current position: a negative value moves the symbol towards the top of the list, a positive one towards its end.

MT5SelectedPageApiResponse

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 MT5SelectedPage One positional window of the selected-symbol list, v2 read DTO.
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.

MT5BookApiResponse

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 MT5Book Full Depth of Market of one symbol, v2 read DTO.
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.

MT5Online

One open connection to the trade server, v2 read DTO.

PropertyTypeDescription
sessionId integer (int64) Session identifier, unique for the trade server while the session lives.
login integer (int64) Login of the account the session belongs to.
group string, nullable Group of the account at the time of the connection.
address string, nullable Address the client connected from.
connectionType string, nullable Kind of the connected application — a trading terminal, a mobile app, a manager terminal or an API client.
build integer (int32) Build number of the connected application.
time string (date-time), nullable Connection time, as the trade server counts it. Absent when the server sent no time.
computerId string, nullable Identifier of the computer the session was opened from.

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.

MT5OnlinePage

One positional window of the live connection list, v2 read DTO.

PropertyTypeDescription
items MT5Online[] Connections of this window.
total integer (int32) Total number of connections on the trade server at the moment of the request.
from integer (int32) Position the window starts at, echoed from the request.

MT5OnlineDisconnectResult

Outcome of the forced disconnection of one login, v2 write DTO.

PropertyTypeDescription
login integer (int64) Login whose connections were dropped.
ok boolean True when every open session of the login was dropped.
code integer (int32) Numeric result of the first session that could not be dropped; zero when the login was dropped in full.
status string, nullable Name of the result code in Code.

MT5SelectedPage

One positional window of the selected-symbol list, v2 read DTO.

PropertyTypeDescription
symbols string[] Symbol names of this window, in list order.
total integer (int32) Total number of symbols in the list at the moment of the request.
from integer (int32) Position the window starts at, echoed from the request.

MT5Book

Full Depth of Market of one symbol, v2 read DTO.

PropertyTypeDescription
symbol string, nullable Symbol the Depth of Market belongs to.
flags string, nullable Depth of Market flags, comma-separated: None, PreAuction or Snapshot.
time string (date-time), nullable Time of the last Depth of Market change, as the trade server counts it. Absent when the server sent no time.
timeMsc string (date-time), nullable Time of the last Depth of Market change with millisecond precision. Absent when the server sent no time.
items MT5BookItem[] Depth of Market entries.