CPlugin

MT4 v2 :: News

API v2 (beta) · MT4 · 5 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

Get news count

GET /api/v2/MT4/{tradePlatform}/NewsTotal

Total number of news items currently held in the pumping cache.

Pump-cached read — instant local lookup, no round-trip to MT4 server. Useful as a cheap polling probe before fetching news bodies.

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 id (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.

Responses

Example

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

Get news body (cached)

GET /api/v2/MT4/{tradePlatform}/NewsBodyGet/{key}

Body text of a cached news item by its key.

Pump-cached read — pair with NewsTotal and NewsGet (later) to enumerate cached news. The key is the news item id known to MT4.

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 id (GUID)
key path integer (int32) yes News item id
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/MT4/$TRADE_PLATFORM_ID/NewsBodyGet/$KEY" \
  -H "Authorization: Bearer $TOKEN"

List news headers

GET /api/v2/MT4/{tradePlatform}/NewsGet

All cached news topic headers (no body — fetch separately).

Pump-cached read — returns the full news topic table held by the pumping connection. Each entry is a header (Key, Time, Topic, Category, Keywords, Priority, LangId). Body text is fetched via NewsBodyGet(key) after asking the pump to populate it via NewsBodyRequest(key).

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 id (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.

Responses

Example

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

Get news header by index

GET /api/v2/MT4/{tradePlatform}/NewsTopicGet/{pos}

Single cached news topic header by zero-based index.

Pump-cached read — useful for paginating news without re-marshalling the whole array. Pair with NewsTotal to bound the index. Returns a wrapper-failure envelope when pos is out of range.

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 id (GUID)
pos path integer (int32) yes Zero-based index into the cached news array
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/MT4/$TRADE_PLATFORM_ID/NewsTopicGet/$POS" \
  -H "Authorization: Bearer $TOKEN"

Request news body fetch

POST /api/v2/MT4/{tradePlatform}/NewsBodyRequest/{key}

Ask the pump to fetch the body for the given news key (fire-and-forget).

POST because this is a side-effect on the pump (it queues a fetch). The wrapper method returns void — there is no synchronous success/failure to surface. A subsequent NewsBodyGet(key) will see the body once the pump has retrieved it. The payload is a sentinel true meaning "request dispatched".

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 id (GUID)
key path integer (int32) yes News item key (from NewsGet/NewsTopicGet)
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/MT4/$TRADE_PLATFORM_ID/NewsBodyRequest/$KEY" \
  -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.

Int32ApiResponse

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 integer (int32)
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

StringApiResponse

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 string, nullable
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

MT4NewsTopicListApiResponse

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 MT4NewsTopic[]
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

MT4NewsTopicApiResponse

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 MT4NewsTopic v2 DTO describing a single news topic header as held in the wrapper's pumping cache. Curated subset of the wrapper's NewsTopic: enough to render a list / browse view of broker-distributed news (Key for follow-up NewsBodyGet / NewsBodyRequest, Time, Topic, Category, Keywords, Priority, LangId). The wrapper's Body property is intentionally excluded — it is x86-only at the unmanaged layer (the MT4 ManagerAPI lays out the body pointer as a 32-bit field and the wrapper throws System.PlatformNotSupportedException on x64) and is fetched separately via NewsBodyGet(key).
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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

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 is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

PropertyTypeDescription
activityId string, nullable W3C trace id for correlating this response in logs and tracing (Seq/SigNoz).
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.

MT4NewsTopic

v2 DTO describing a single news topic header as held in the wrapper's pumping cache. Curated subset of the wrapper's NewsTopic: enough to render a list / browse view of broker-distributed news (Key for follow-up NewsBodyGet / NewsBodyRequest, Time, Topic, Category, Keywords, Priority, LangId). The wrapper's Body property is intentionally excluded — it is x86-only at the unmanaged layer (the MT4 ManagerAPI lays out the body pointer as a 32-bit field and the wrapper throws System.PlatformNotSupportedException on x64) and is fetched separately via NewsBodyGet(key).

PropertyTypeDescription
key integer (int32) News key — the identifier used by NewsBodyGet and NewsBodyRequest to fetch the body for this topic.
time string (date-time) Published time of the news topic (UTC).
topic string, nullable News headline / subject (max 256 chars at the wrapper layer).
category string, nullable News category. Slash-separated path on the wrapper side (e.g. "Markets\Asian Markets News") used by the MT4 client terminal to build a tree view. Max 64 chars at the wrapper layer.
keywords string, nullable Comma-separated keyword list (max 256 chars). Used by quote-feed brokers as a symbol filter — for example "!EURUSD, EUR*" selects all EUR pairs except EURUSD.
priority integer (int32) News priority: 0 = general, 1 = high.
langId integer (int32) Windows LCID language id. 0 means unspecified; otherwise the low 16 bits of a Windows LCID (the language portion).