The resolved hub URL including the tradePlatform query parameter.
Intended for tests and diagnostic tooling.
Returns the underlying HubConnection for advanced use (manual .on/.invoke
calls not covered by the typed helpers below). Throws if not started yet.
Subscribe to OnConnectionStatus callbacks. The server pushes one such
event right after the handshake completes.
May be called before or after start() — registering before start() is
strongly recommended to avoid missing the initial post-handshake push.
Subscribe to OnTick callbacks. Pair with subscribeToTicks(symbol).
May be called before or after start() — registering before is recommended
so no early server push is missed.
Subscribe to OnTicksBatch callbacks. Pair with subscribeToTicksBatch(symbol).
A batch carries every tick the server accumulated during one interval; a
connection subscribed to batches does not receive per-tick OnTick events.
May be called before or after start() — registering before is recommended
so no early batch is missed.
Open the SignalR connection. Idempotent — calling twice while already connected resolves without action.
Close the SignalR connection. Safe to call on a connection that was never started or has already been closed.
Returns an AsyncIterable<MT5MarginCallPayload> backed by the server-side
StreamMarginCallUpdates stream. Use in a for await loop.
Returns an AsyncIterable<MT5TickPayload>. When symbol is omitted, every
symbol's ticks flow through.
Optionalsymbol: stringSubscribe the connection to a per-symbol tick stream. Server will push
OnTick callbacks for every tick of that symbol until unsubscribed.
Subscribe the connection to batched ticks of one symbol. The server sends
one OnTicksBatch event every intervalMs milliseconds (20–60000, default 200)
or as soon as maxBatchSize ticks are buffered (1–10000, default 200).
While subscribed, per-tick OnTick events are not delivered for that symbol.
Subscribing twice to the same symbol keeps the first subscription and its
policy. The subscription lasts until unsubscribeFromTicksBatch(symbol) or
until the connection closes. Out-of-range values are rejected by the server.
Resolve a token via this client's token provider. Intended for tests to verify that the shared provider is wired correctly.
Stop the per-symbol tick stream started by subscribeToTicks(symbol).
Stop the batched tick stream started by subscribeToTicksBatch(symbol).
SignalR wrapper around
/hubs/mt5/v2. Holds a singleHubConnectionand exposes typed helpers for the MT5 real-time scope: connection status, ticks and margin calls.Lifecycle:
new MT5V2SignalRClient(opts)— synchronous; resolves the token provider and pre-computes the hub URL but does NOT open a socket.onConnectionStatus()/onTick()— MAY be called beforestart(). Registering beforestart()is recommended so the initial post-handshakeOnConnectionStatuspush is never missed.await client.start()— opens the WebSocket connection. All callbacks queued beforestart()are attached to theHubConnectionbefore the socket opens, guaranteeing they are in place before any server push arrives.streamTicks()/streamMarginCallUpdates()to consume streams (requires an open connection).await client.stop()— closes the connection.