How to connect, authenticate and reconnect is on the realtime overview.
The trade platform is fixed by the connection, so no call takes it as an argument. Send every argument of a call:
SignalR does not apply defaults declared on the server, so where a parameter has a default the table names the value to
send, and null stands for "all" or "default" where a parameter accepts it. The first event,
OnMT4ConnectionStatus,
arrives without subscribing.
Calls that start or stop a push of events to this connection.
SubscribeToTicks
SubscribeToTicks(symbol)
Subscribe to tick updates of one symbol
After this call the server pushes OnTick to the calling connection for every
tick of symbol on the bound trade platform. Call it once per symbol; several symbols can be
subscribed on the same connection. For the stream model use StreamTicks.
The caller receives OnTicksBatch and no per-tick OnTick
for the symbol. A batch is sent when its oldest tick has waited intervalMs milliseconds, or at
once when maxBatchSize ticks have been collected; the timer checks about every 50 ms, so a
shorter interval behaves as 50 ms. A value outside the accepted range is refused with an error. Repeating the
call for the same symbol replaces the previous subscription, so the new interval and size take effect.
Permission: Request (read) on symbols
Arguments
Name
Type
For the default, send
Description
symbol
string
—
Symbol name, matched case-insensitively.
intervalMs
integer
200
Longest time a tick may wait for its batch, in milliseconds; 20 to 60000. Send 200 for the default.
maxBatchSize
integer
200
Largest number of ticks in one event; 1 to 10000. Send 200 for the default.
The server sends the ticks of all symbols of the bound trade platform as one
OnTicks event every 200 ms. Repeating the call replaces the previous
subscription.
Permission: Request (read) on symbols
Example
await connection.invoke("SubscribeToAllTicks");
UnsubscribeFromAllTicks
UnsubscribeFromAllTicks()
Unsubscribe from the aggregated ticks of every symbol
Stops the OnTicks events started by SubscribeToAllTicks.
The server builds candles from the ticks of each period and sends one
OnTicksOHLC event per period with a candle for every symbol that ticked. Repeating
the call replaces the previous subscription, so a new period takes effect. A period above 60 seconds is refused
with an error rather than shortened.
Permission: Request (read) on symbols
Arguments
Name
Type
For the default, send
Description
periodSeconds
integer
60
Candle length in seconds; 1 to 60. Send 60 for the default.
The server sends margin-level snapshots of the accounts of the bound trade platform as one
OnMarginUpdate event per second. Repeating the call replaces the previous
subscription. For the stream model use StreamMarginCallUpdates.
The server sends one OnSymbolUpdate event for every symbol of the bound
trade platform that is added, changed or removed. For the stream model use StreamSymbolUpdates.
Permission: Request (read) on symbols
Example
await connection.invoke("SubscribeToSymbols");
UnsubscribeFromSymbols
UnsubscribeFromSymbols()
Unsubscribe from symbol-configuration changes
Stops the OnSymbolUpdate events of this connection.
Returns a server-to-client stream of ticks. With a null symbol the stream carries every
symbol of the bound trade platform; with a symbol it carries that symbol only, matched case-insensitively.
The stream stays open until the client cancels it or disconnects. A client that reads too slowly loses its
oldest ticks.
Returns a server-to-client stream of order updates (opened, modified, closed or deleted) for the bound
trade platform, until the client cancels it or disconnects.
Returns a server-to-client stream of account-record updates (created, modified or deleted, including
a change of group) for the bound trade platform, until the client cancels it or disconnects. The payload is
slim by design: passwords and other credentials are never sent.
Returns a server-to-client stream of symbol-configuration updates (added, changed or removed) for the
bound trade platform, until the client cancels it or disconnects.
Whether WebAPI is connected to the trade platform behind the hub. Sent once right after the
client connects (with the current state) and again at every change; needs no subscribing call.
connection.on("OnMT4ConnectionStatus", data => console.log(data));
Account went online or offline — delivered to subscribers of
SubscribeToOnlineUpdates.
connection.on("OnOnlineUpdate", data => console.log(data));
Payloads
The data the events and streams carry, with JSON property names as sent. A type marked or null
may be null; every other field is always present. A value of a list type is an array.
TickPayload
Market tick of one symbol on the bound trade platform.
Property
Type
Description
symbol
string
Symbol name as reported by the trade server.
bid
number
Bid price of the tick.
ask
number
Ask price of the tick.
lastTime
string (date-time) or null
Time of the tick in the trade server's time zone; null when the server reports none.
MarginCallPayload
Margin-level snapshot of one account.
Property
Type
Description
login
integer
Account login.
group
string or null
Group the account belongs to; null when the server reports none.
Whether the account is read-only: it may log in but not trade.
regDate
string (date-time)
When the account was registered.
lastDate
string (date-time)
When the account last connected.
email
string
E-mail address of the account holder.
phone
string
Phone number of the account holder.
comment
string
Free-form comment of the account record.
UserUpdateKind
Kind of an account-record change.
Sent as one of these names:
Value
Meaning
Added
The account was created.
Updated
The account was modified, including a change of group.
Deleted
The account was deleted.
SymbolUpdatePayload
A symbol configuration changing state. Only the trading-relevant settings are sent; the rest of the configuration (session calendars, swap settings) is available over REST.
Ticks collected since the previous batch, oldest first.
TicksPayload
Aggregated ticks of one or more symbols, sent on a fixed interval instead of one message per tick. The list is ordered oldest first and is never empty.