We're still building this. Field names may change before launch.
Streaming
The per-account WebSocket protocol. Full sync, incremental updates, market data, sequence numbers and resume.
There are two ways to stream:
- A socket.io protocol for existing clients that already speak it, alongside the
/users/current/…REST API. See Switching from another provider. - Tickwire’s plain WebSocket protocol (this page): JSON frames, one socket per account, easy to use from any language without an SDK.
Connect
wss://api.tickwire.io/users/current/accounts/{accountId}/ws?auth-token=<token>
Or, better, leave the key out of the URL and send it as the auth-token (or X-API-Key, or
Authorization: Bearer) header on the upgrade, if your client can set headers. Browsers can’t, so
they use the query parameter; give a browser a short-lived scoped token,
not a full key. See WebSockets: header or query parameter.
Subscribe
{
"type": "subscribe",
"sync": { "startingHistoryTime": "2026-09-01T00:00:00Z", "sessionId": null, "lastSeq": null },
"marketData": [
{ "symbol": "EURUSD", "subscriptions": [
{ "type": "quotes", "intervalInMilliseconds": 500 },
{ "type": "candles", "timeframe": "1m" },
{ "type": "ticks" },
{ "type": "marketDepth" }
] }
]
}
sync.startingHistoryTime: send history (deals and history orders) from this time.nullsends all history.sync.startingHistoryOrderTimeandsync.startingDealTimeset it for one kind only.sync.sessionIdandsync.lastSeq: resume after a disconnect (below). Leave them out on a first connect.marketData: optional. Withoutsubscriptionsyou get quotes.ticksandmarketDepthare MT5 only. On MT4 they are refused with anerrorframe andnot_supported_on_mt4. The rest of the stream carries on.
We answer with a subscribed frame. It carries your sessionId and the market data you now
receive.
Send {"type": "unsubscribe", "marketData": [...]} to drop market data. You get an unsubscribed
frame back. {"type": "unsubscribe"} with no marketData ends the session and closes the socket.
Send {"type": "ping"} whenever you like; you’ll get pong.
Frames
Every server frame has type, seq (increasing by one per frame) and time (UTC).
Full synchronization, in this order. Every sync frame carries the same synchronizationId.
| Frame | Carries |
|---|---|
synchronizationStarted | sessionId, platform, historyStartTime, historyOrdersSupported and the broker time offset |
brokerConnectionStatus | connected |
health | our health snapshot |
accountInformation | accountInformation |
specifications | symbol specifications |
positions | the full list (replace yours) |
positionsSynchronized | Nothing else |
orders | the full list of pending orders (replace yours) |
ordersSynchronized | Nothing else |
historyOrders | a batch; may repeat |
historyOrdersSynchronized | Nothing else |
deals | a batch; may repeat |
dealsSynchronized | Nothing else |
synchronized | Your state is complete |
Prices for the symbols you subscribed to follow.
Incremental updates after that: accountInformationUpdated, positionUpdated,
positionRemoved, orderUpdated, orderCompleted, historyOrderAdded, dealAdded.
Market data: prices (with the account’s equity, margin, freeMargin and marginLevel),
candles, ticks and book.
Status: health (our health snapshot) whenever it changes, and
brokerConnectionStatus with connected: true|false.
Control: subscribed, unsubscribed, resumed, pong, error (with error and message)
and warning, for example when you read too slowly (below).
{ "type": "positionUpdated", "seq": 1842, "time": "2026-09-23T11:02:14.120Z",
"position": { "id": "46870472", "symbol": "EURUSD", "type": "POSITION_TYPE_BUY", "volume": 0.01,
"openPrice": 1.07182, "profit": 0.42, "brokerTime": "2026-09-23 14:02:14.120" } }
Resume after a disconnect
Keep the sessionId from synchronizationStarted or subscribed, and the last seq you
processed. Reconnect and subscribe with both:
{ "type": "subscribe", "sync": { "sessionId": "<your sessionId>", "lastSeq": 2010 } }
- If we still hold every frame after
lastSeq, we replay them. Then aresumedframe arrives withfromSeq,toSeqandreplayed. No gap, no full sync. - If not, we run a full synchronization in the same session.
seqkeeps counting up. Replace your state whensynchronizedarrives. lastSeqwithoutsessionIdalways gets a full synchronization.
Slow consumers
If you don’t read fast enough, we don’t buffer forever. We drop frames and send:
{ "type": "warning", "seq": 2210, "code": "slow_consumer",
"firstMissingSeq": 2011, "lastMissingSeq": 2209, "droppedFrames": 199 }
Resume with your sessionId and lastSeq: 2010 to get the missing frames back, or accept a fresh
sync. If your queue stays full for 30 seconds, we close the socket with code 4008. You can resume
the same way.
Close codes
| Code | Meaning |
|---|---|
1000 | You sent unsubscribe with no marketData |
4001 | The session was resumed on another socket |
4008 | Slow consumer. Resume with sessionId and lastSeq |
4029 | Too many sessions |
Heartbeats
We send a frame at least every 15 seconds, a health frame if nothing else is happening. If you
hear nothing for 60 seconds, reconnect.