API v2 (beta) · MT4 · 16 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.
Pump-cached snapshot of all open trades on the platform, returned paginated. Sort key is the order ticket ascending. ?limit= caps page size; without it all open trades come back in one page.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
limit
query
integer (int32)
no
Maximum number of items to return in one page. Omit to return all items in a single page. Maximum allowed value is 5000.
cursor
query
string
no
Opaque continuation token. Pass the value from the previous response's meta.paging.nextCursor to fetch the next page; omit for the first page.
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.
GET /api/v2/MT4/{tradePlatform}/TradesGet/{ticket}
Open trade by ticket from the pump cache (dictionary lookup variant).
Counterpart to TradeRecordGet/{order} — both are pump reads,
but the wrapper exposes two distinct call paths: TradeRecordGet
uses a dedicated single-record method, while this endpoint looks the
trade up in the open-trades dictionary. Behaviourally equivalent for
open trades; TradeRecordGet can also resolve recently closed
trades that linger in cache.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
ticket
path
integer (int32)
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.
GET /api/v2/MT4/{tradePlatform}/TradesGetByLogin/{login}/{group}
Open trades for a single account from the pump cache.
Pump-cached lookup, keyed by login + group. The group parameter is
required because the wrapper organises trades by group internally —
callers can fetch the group via UserRecordGet/{login} first.
Empty list when the account has no open trades.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
login
path
integer (int32)
yes
Account login (positive integer)
group
path
string
yes
Account group name (max 16 chars)
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.
Open and pending orders for a specific symbol from the pump cache.
Pump-cached snapshot — instant local lookup, no MT4 round-trip. Useful
for per-instrument risk monitoring. Empty array is a legitimate result
(no live trades on that 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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
symbol
query
string
no
Symbol to filter by (e.g. EURUSD)
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.
All market-condition (non-pending) open trades from the pump cache.
Pump-cached snapshot of every open market order across all accounts.
Pending orders (limits/stops) are excluded — for those query per-symbol
or per-account. Empty array is a legitimate result on idle servers.
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
Name
In
Type
Required
Description
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.
GET /api/v2/MT4/{tradePlatform}/TradeRecordGet/{order}
Single trade record by order ticket from the pump cache.
Pump-cached lookup of one order. Wrapper-level failures (unknown
ticket, cache miss) surface in the envelope's ManagerAPICode /
ErrorCode pair — clients must branch on isError before dereferencing
payload.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
order
path
integer (int32)
yes
Order ticket 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.
Validate an order's SL/TP/pending-open levels against the symbol's administrator-set stops_level.
Pump-cached call. The MT4 server verifies that the supplied SL/TP
(and, for pending orders, the open price) sit at least
stops_level away from the current market and that pending
expiration is at least ten minutes in the future. Returns a bare
boolean envelope: true when the wrapper's ResultCode
is Ok.
Useful for client-side pre-flight before submitting a real
TradeTransaction — saves a server round-trip for invalid
orders.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
price
query
number (double)
no
Reference price for the validation (typically current bid/ask).
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
MT4TradeTransaction (application/json) — Trade transaction shape — same DTO as TradeTransaction.
POST /api/v2/MT4/{tradePlatform}/TradeClearRollback/{order}
Roll back an in-flight trade transaction by ticket.
Pump-cached call. Cancels a pending trade transaction that the
MT4 server is still holding in the rollback buffer (e.g. an
instant-execution requote that has not yet been confirmed). Has
no effect once the transaction has been committed; returns the
wrapper's ResultCode as part of the envelope on failure.
Idempotent on already-committed/already-rolled-back tickets.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
order
path
integer (int32)
yes
Order ticket (positive int) to roll back.
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.
curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradeClearRollback/$ORDER" \
-H "Authorization: Bearer $TOKEN"
Get trade record (live)
GET /api/v2/MT4/{tradePlatform}/TradeRecordRequest/{order}
Fresh-from-server fetch of a single trade record by ticket.
Manager (live) counterpart to TradeRecordGet. Where the pump
variant reads from local cache (may lag by milliseconds), this round-
trips to the MT4 server every call — slower but authoritative.
Useful for reconciliation, post-close ticket lookups (pump may have
flushed), or any flow where the caller can tolerate the latency cost
in exchange for guaranteed freshness. Returns NotFound envelope when
the ticket does not exist on the server.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
order
path
integer (int32)
yes
Order ticket 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.
Broad Manager-live trade query. Returns every trade visible to the authenticated manager, paged by ticket ascending.
Manager (live) — each call hits the MT4 server. Designed as the
"scan from scratch" counterpart to the pump variants
(TradesGetByMarket, TradesGetBySymbol): pump reads are
instant but limited to currently-open trades visible to the pump;
this endpoint returns the full server-side set the manager can see.
Heavy — paginate aggressively, prefer pump variants when freshness
is not critical.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
limit
query
integer (int32)
no
Maximum number of items to return in one page. Omit to return all items in a single page. Maximum allowed value is 5000.
cursor
query
string
no
Opaque continuation token. Pass the value from the previous response's meta.paging.nextCursor to fetch the next page; omit for the first page.
group
query
string
no
Optional case-sensitive exact-match filter on account group.
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.
POST /api/v2/MT4/{tradePlatform}/AdmTradeRecordModify/{ticket}
Admin direct edit of a single trade record — Type 1 with read-first.
Low-level back-office override that writes directly to the trade
record. For SL/TP edits prefer
POST TradeTransaction with tradeTransactionType=BrModify
— that route goes through the wrapper's audited path. Use this
endpoint for manual accounting corrections (commission/storage/taxes/
profit, comment, magic) that the standard TradeTransaction path
does not cover.
Flow: read existing trade via TradeRecordsRequest, patch the
allow-listed fields in place, submit via AdmTradeRecordModify.
Order/Login/Symbol/Volume/OpenPrice/OpenTime/CloseTime and gateway
internals are preserved by virtue of not being on the input DTO.
Idempotency-Key strongly recommended. A retried edit without it can
land twice — usually harmless, but generates audit log noise.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
ticket
path
integer (int32)
yes
Order ticket (path)
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
MT4TradeUpdate (application/json) — Patch fields. The DTO's order field is ignored — the path parameter is the source of truth.
Submit a trade transaction — open / modify / close / balance op.
POST mutator covering every wrapper trade operation through the single
TradeTransaction entry point. The request body's
tradeTransactionType + tradeCommand combination selects
the actual operation — OpenMarket+Buy, PendingOpen+BuyLimit,
CloseMarket+Sell, and the manager-side Br* types:
BrModify (open price, SL, TP of an order), BrDelete,
BrBalance+Balance or Credit (balance/credit operation on
orderBy). The schema of the request body lists every accepted value.
An unknown tradeTransactionType, tradeCommand or
tradeRequestFlags value is refused with error code Validation
and the list of valid values; nothing is sent to the trading platform.
Names are case-insensitive; the numeric value of a member is accepted too.
On success the response echoes the wrapper's mutated structure — most
importantly the Order field, which the server assigns on Open
operations and clients use to track the ticket afterwards.
Idempotency-Key is essentially mandatory. A retried trade
transaction without the header can open a second position, double-
close, or apply a balance op twice. With the header the second call
returns the cached envelope from the first.
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
Name
In
Type
Required
Description
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: 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.
GET /api/v2/MT4/{tradePlatform}/TradeRecordsRequest
Trade records for a batch of order tickets — live round-trip.
Manager (live) call. Pass tickets as repeated query parameters:
?orders=12345&orders=67890. Server-side billing counts this
as one Manager request regardless of array length — prefer this over
looping single TradeRecordGet calls.
Returns the trade records the server has for the requested tickets.
Order in the response is NOT guaranteed to match the request order;
missing tickets are silently omitted (the envelope is not an error
envelope in that case — match by order field on the client).
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
orders
query
integer (int32)[]
no
Order tickets to request (repeat the query parameter)
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.
GET /api/v2/MT4/{tradePlatform}/AdmTradesRequest/{group}
All trades belonging to accounts in a given group (admin scope).
Manager (live) call. Returns trades for every account assigned to
the given group. openOnly=true filters out closed trades on
the server side. Pair with Idempotency-Key on retry — large
groups can return substantial payloads.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
group
path
string
yes
Account group name (max 16 chars)
openOnly
query
boolean
no
If true, only open trades are returned. Defaults to true.
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.
Bulk-deletes a list of trade tickets (administrative scope). Used for cleanup after reconciliation mistakes, simulator state reset, or compliance-mandated removal.
Manager-live POST. The wrapper accepts a flat int[] of order
tickets and a count; we mirror the existing batched-int pattern
(repeat ?orders= per ticket — same convention as
UserRecordsRequest's ?logins=). Empty arrays are
rejected with Validation.
Destructive. Each ticket in the array is removed from the
server's trade table; this is not reversible from the API side.
Pair with Idempotency-Key so retries don't re-process partial
failures.
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
Name
In
Type
Required
Description
tradePlatform
path
string (uuid)
yes
Trade platform id (GUID)
orders
query
integer (int32)[]
no
Order tickets to delete (repeat the query parameter — must be non-empty)
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.
curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/AdmTradesDelete" \
-H "Authorization: Bearer $TOKEN"
Start trade-records sync
POST /api/v2/MT4/{tradePlatform}/TradesSyncStart
Opens a server-side incremental sync session for trade records modified at or after timestamp.
Manager-live POST (modifies server-side session state). The
follow-up TradesSyncRead drain is deferred under wine x64
(see deferral note in the Users section above). Pass
timestamp=0 to request all trades. The timestamp is Unix
epoch seconds (int32) in MT4 server-local time, not UTC.
Timeout: 60 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.
How long to wait for the trade server, in seconds (1–300). Default for this operation: 60 s (server maintenance). 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.
curl -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/TradesSyncStart" \
-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.
MT4TradeListApiResponse
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.
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.
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.
MT4TradeApiResponse
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.
v2 DTO mirroring the wrapper's TradeRecord. The set of fields is curated for typical client use-cases — order monitoring, P&L reporting, trade history reconciliation. Internal padding/reserved/gateway-internal/raw underscore-prefixed fields are intentionally excluded. Span<>-typed helpers (ConvRates, ConvReserv, APIData) are excluded because System.Text.Json cannot serialize ref-struct-backed properties — those would force callers onto a custom converter for marginal value. Enum members (TradeCommand, TradeRecordState, TradeRecordReason, ActivationType) serialize as string names via V2JsonContext UseStringEnumConverter — e.g. "Buy" rather than 0.
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.
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.
MT4TradeTransaction
v2 DTO for a trade transaction — input AND output of TradeTransaction. The wrapper's TradeTransInfo is in/out: the caller fills the request fields (operation type, command, symbol, volume, price), submits via POST, and the server populates the resulting Order id (for Open) or echoes the modified record (for Modify/Close). Enum fields (TradeTransactionType, TradeCommand, TradeRequestFlags) are exposed as plain strings. Clients submit the enum name (e.g. "Buy", "PendingOpen"); the response echoes the names back. This dodges the leaf-enum nested-generic STJ source-gen quirk documented in feedback-stj-enum-leaf-nested. The valid names in the API reference are generated from the enums (CPlugin.SaaSWebApps.WebAPI.Code.EnumStringSchemaFilter), so keep them out of the summaries.
Property
Type
Description
tradeTransactionType
string, nullable
Transaction type (required). Manager-side operations use the Br* types, e.g. BrBalance with trade command Balance or Credit for a balance or credit operation. One of: PricesGet, PricesRequote, OpenInstant, OpenRequest, OpenMarket, PendingOpen, CloseInstant, CloseRequest, CloseMarket, Modify, Delete, CloseBy, CloseAll, BrOpen, BrClose, BrDelete, BrCloseBy, BrCloseAll, BrModify, BrActivate, BrComment, BrBalance. Case-insensitive; the numeric value is accepted too. Any other value is refused with error code Validation.
tradeCommand
string, nullable
Trade command. Empty means Buy. One of: Buy, Sell, BuyLimit, SellLimit, BuyStop, SellStop, Balance, Credit. Case-insensitive; the numeric value is accepted too. Any other value is refused with error code Validation.
tradeRequestFlags
string, nullable
Request flags (who placed the request). Empty means None. Flags, names joined by ", ": None, Signal, Expert, Gateway, Mobile, Web, API. Case-insensitive; numbers are accepted.
expiration
string (date-time)
Pending order expiration time. Default value means GTC.
order
integer (int32)
Order ticket. 0 on Open requests; server fills this on success.
orderBy
integer (int32)
Login (account number). Required for Balance/Credit operations.
symbol
string, nullable
Symbol (max 12 chars)
volume
integer (int32)
Volume in MT4 internal units. 1 lot = 100, so e.g. 250 = 2.5 lots.
CRC for transaction integrity; usually 0 (server fills).
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.
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.
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.
MT4TradeUpdate
Type 1 mutator input for the admin direct-edit endpoint AdmTradeRecordModify. Only the fields a back-office tool would legitimately need to adjust are exposed; everything else (order id, login, symbol, volume, open/close times, gateway internals, conversion rates, API data blobs) is preserved from the server-side read. For typical stop-loss / take-profit edits prefer POST TradeTransaction with tradeTransactionType=BrModify — that goes through the wrapper's audited path. This endpoint is the low-level admin override for back-office corrections.
Property
Type
Description
order
integer (int32)
Order ticket to edit (path parameter is the source of truth)
sl
number (double)
New stop-loss price (0 = remove SL)
tp
number (double)
New take-profit price (0 = remove TP)
magic
integer (int32)
Magic number / EA tag
comment
string, nullable
Comment (broker-visible)
commission
number (double)
Manual commission override
commissionAgent
number (double)
Manual agent-commission override
storage
number (double)
Swap / storage override
profit
number (double)
Profit override (back-office correction only)
taxes
number (double)
Taxes override
MT4TradeTransactionApiResponse
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.
v2 DTO for a trade transaction — input AND output of TradeTransaction. The wrapper's TradeTransInfo is in/out: the caller fills the request fields (operation type, command, symbol, volume, price), submits via POST, and the server populates the resulting Order id (for Open) or echoes the modified record (for Modify/Close). Enum fields (TradeTransactionType, TradeCommand, TradeRequestFlags) are exposed as plain strings. Clients submit the enum name (e.g. "Buy", "PendingOpen"); the response echoes the names back. This dodges the leaf-enum nested-generic STJ source-gen quirk documented in feedback-stj-enum-leaf-nested. The valid names in the API reference are generated from the enums (CPlugin.SaaSWebApps.WebAPI.Code.EnumStringSchemaFilter), so keep them out of the summaries.
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.
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.
MT4Trade
v2 DTO mirroring the wrapper's TradeRecord. The set of fields is curated for typical client use-cases — order monitoring, P&L reporting, trade history reconciliation. Internal padding/reserved/gateway-internal/raw underscore-prefixed fields are intentionally excluded. Span<>-typed helpers (ConvRates, ConvReserv, APIData) are excluded because System.Text.Json cannot serialize ref-struct-backed properties — those would force callers onto a custom converter for marginal value. Enum members (TradeCommand, TradeRecordState, TradeRecordReason, ActivationType) serialize as string names via V2JsonContext UseStringEnumConverter — e.g. "Buy" rather than 0.
Property
Type
Description
order
integer (int32)
Order ticket number
login
integer (int32)
Owner account login
symbol
string, nullable
Symbol traded (e.g. EURUSD)
digits
integer (int32)
Symbol precision (number of digits after the decimal point)
tradeCommand
TradeCommand
Trade direction / pending order type (Buy/Sell/BuyLimit/etc)
volume
integer (int32)
Volume stored ×100 (e.g. 15 means 0.15 lots — see VolumeLots)
volumeLots
number (double)
Volume expressed in lots, for human consumption (Volume / 100)
tradeRecordState
TradeRecordState
Lifecycle state of the trade record
openPrice
number (double)
Price at which the order was opened
sl
number (double)
Stop-loss price (0 if unset)
tp
number (double)
Take-profit price (0 if unset)
openTime
string (date-time)
Order open timestamp
closeTime
string (date-time)
Order close timestamp (default for still-open orders)
closePrice
number (double)
Price at which the order was closed
commission
number (double)
Broker commission
commissionAgent
number (double)
Agent (IB) commission
storage
number (double)
Accumulated swap / rollover charges
profit
number (double)
Realised / floating profit
taxes
number (double)
Taxes withheld
magic
integer (int32)
Expert advisor magic number — client-supplied tag
comment
string, nullable
Free-form order comment
expiration
string (date-time)
Expiration timestamp for pending orders
tradeRecordReason
TradeRecordReason
Reason the trade record was created/modified (Client/Expert/Dealer/Stopout/etc)
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.
Property
Type
Description
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.
Property
Type
Description
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.