WebSockets
The streaming API delivers a real-time feed of account information, positions, orders, and closed deals over a single WebSocket connection. Subscribe to one or more accounts on one socket; each subscription first receives an ordered snapshot, then a stream of incremental updates.
Every message is JSON. The server stamps a monotonic sequence_number and an ISO-8601 timestamp on every frame it sends.
Connecting
Connect to wss:/ and authenticate by putting your API key in the api_key query parameter:
wss:/ / api.fundedops.com/ v1/ stream? api_key= fo_live_...Warning: the API key travels in the URL's query string. Keep this URL out of logs, printed output and bug reports. Treat the whole connect string as a secret.
If the key is missing, malformed, revoked, expired, or belongs to an inactive client, the server sends an error frame and closes with code 4401:
{ "type": "error", "id": 401, "error": "UnauthorizedError", "message": "Invalid API key", "requestId": null }For an expired key, the message is This API key expired on 4 Mar 2026. Create a new key in the API portal. The date is in UTC.
An open stream is checked again while it runs. When its key is revoked or expires, or you close your API account, it gets the same error frame and closes with 4401 on its next subscribe, resync, subscribe_quotes or subscribe_candles frame, or at the next ping, within 30 seconds, whichever comes first. Connect again with an active key.
Subscribing
Send one subscribe frame per account. Include a request_id you generate (any unique string) so you can correlate any error response back to the frame that caused it:
{ "type": "subscribe", "account_id": "9b2c…", "request_id": "1f0a…" }There is no separate acknowledgement frame. A successful subscribe is acknowledged by the snapshot sequence that immediately follows (see below). Failures come back as an error frame echoing your request_id:
{ "type": "error", "id": 404, "error": "NotFoundError", "message": "Account not found", "requestId": "1f0a…" }A missing account_id returns 400 ValidationError; an account you do not own returns 404 NotFoundError (indistinguishable from one that does not exist, so there is no enumeration oracle). Both are per-subscribe: the socket stays open.
To stop receiving updates for an account, send { "type": "unsubscribe", "account_id": "9b2c…" }.
Snapshot sequence
Immediately after a successful subscribe, the server emits an ordered snapshot bracketed by sync_started / sync_finished, both carrying the same sync_id:
{ "type": "sync_started", "account_id": "9b2c…", "sync_id": "7a…", "sequence_number": 1, "timestamp": "2026-07-09T12:00:00Z" }{ "type": "account_information", "account_id": "9b2c…", "account_information": { "balance": 10000.0, "equity": 10120.5, "margin": 210.0, "freeMargin": 9910.5, "marginLevel": 4819.3, "leverage": 100, "currency": "USD", "dailyPnl": 120.5, "updatedAt": "2026-07-09T12:00:00Z" }, "sequence_number": 2, "timestamp": "2026-07-09T12:00:00Z" }{ "type": "positions", "account_id": "9b2c…", "positions": [ { "id": "…", "ticket": 55123456, "platform": "mt5", "symbol": "EURUSD", "type": "buy", "volume": 0.10, "openPrice": 1.08420, "currentPrice": 1.08535, "profit": 11.5, "swap": 0.0, "commission": -0.7, "stopLoss": 1.08000, "takeProfit": 1.09000, "openTime": "2026-07-09T11:40:00Z", "updatedAt": "2026-07-09T12:00:00Z" } ], "sequence_number": 3, "timestamp": "2026-07-09T12:00:00Z" }{ "type": "orders", "account_id": "9b2c…", "orders": [], "sequence_number": 4, "timestamp": "2026-07-09T12:00:00Z" }{ "type": "sync_finished", "account_id": "9b2c…", "sync_id": "7a…", "sequence_number": 5, "timestamp": "2026-07-09T12:00:00Z" }The snapshot is read from the FundedOps mirror, not the connection, so it holds the account's last-known state. When you see sync_finished, you hold a complete, consistent picture of that account.
Every position, order, and deal frame carries a platform field ("mt4" or "mt5") identifying the account it belongs to, in the snapshot frames and in each incremental updated[] entity.
Incremental updates
After the snapshot, changes arrive as incremental frames. Positions and orders carry deltas keyed by ticket.
account_information_updated: new equity/balance figures:
{ "type": "account_information_updated", "account_id": "9b2c…", "account_information": { "balance": 10000.0, "equity": 10142.0, "marginLevel": 4830.0, "updatedAt": "2026-07-09T12:00:05Z" }, "sequence_number": 6, "timestamp": "2026-07-09T12:00:05Z" }positions_updated: updated holds the current open positions; removed_ids lists tickets that closed since the last frame:
{ "type": "positions_updated", "account_id": "9b2c…", "updated": [ { "ticket": 55123456, "platform": "mt5", "symbol": "EURUSD", "type": "buy", "volume": 0.10, "profit": 18.0 } ], "removed_ids": [], "sequence_number": 7, "timestamp": "2026-07-09T12:00:05Z" }orders_updated: updated holds current pending orders; completed_ids lists orders that resolved:
{ "type": "orders_updated", "account_id": "9b2c…", "updated": [], "completed_ids": ["55987654"], "sequence_number": 8, "timestamp": "2026-07-09T12:00:06Z" }deal_added: a deal was closed (mirrors the history-deal shape):
{ "type": "deal_added", "account_id": "9b2c…", "deal": { "id": "…", "ticket": 66001122, "platform": "mt5", "symbol": "EURUSD", "type": "sell", "volume": 0.10, "openPrice": 1.08420, "closePrice": 1.08600, "openTime": "2026-07-09T11:40:00Z", "closeTime": "2026-07-09T12:00:06Z", "profit": 18.0, "swap": 0.0, "commission": -0.7, "positionId": "55123456", "stopLoss": 1.08000, "takeProfit": 1.09000, "comment": null }, "sequence_number": 9, "timestamp": "2026-07-09T12:00:06Z" }A deal's commission holds its commission and fees, including its share of what opening the position cost. When a position is closed in parts, each deal carries the share for the volume it closed.
On MT4 accounts a deal's ticket equals its positionId, and each closed round-trip surfaces as a single deal, as MT4 has one history pool, not MT5's separate entry/exit deals.
MT4 specifics: MT4 accounts read and stream through the same frames as MT5, with four platform differences to know: single history model (one MT4
MODE_HISTORYpool feeds bothhistory-dealsandhistory-orders);ticket = position_id(no separate position ticket); no stop-limit order types (onlybuy_limit,sell_limit,buy_stop,sell_stop); and partial close opens a new ticket for the remainder rather than shrinking the original. List History Positions joins those tickets back into one row through the broker'sto #andfrom #comment links, and a piece the broker does not number stays its own row. After a Close By, the position that was closed by the other shows volume 0 and the other carries the profit.
MT5 specifics: On a hedging account a close by gives each of the two positions its own closing deal. A netting account holds one position per symbol. Adding to it updates its
volumeandopenPrice, the volume-weighted entry price. A reversal closes the position with a deal for its whole volume and opens the rest as a new position with a new ticket:positions_updatedlists the old ticket inremoved_idsand the new position inupdated. A closing deal'spositionIdis always the ticket the position had when the deal closed it.
status: the derived connection status changed. connection_status is one of connected, disconnected, or disconnected_from_broker:
{ "type": "status", "account_id": "9b2c…", "connection_status": "disconnected", "last_heartbeat_at": "2026-07-09T12:00:00Z", "sequence_number": 10, "timestamp": "2026-07-09T12:00:35Z" }state: the account's lifecycle state changed while you are subscribed, for example deploying to deployed, or deployed to undeploying. Connection status exists only while an account is deployed:
{ "type": "state", "account_id": "9b2c…", "state": "undeploying", "sequence_number": 11, "timestamp": "2026-07-09T12:05:00Z" }freshness: every 30 seconds, how old the data of each subscribed account is. data_age_seconds counts from the account's last heartbeat; a connected account reports every few seconds:
{ "type": "freshness", "accounts": [{ "account_id": "9b2c…", "state": "deployed", "connection_status": "connected", "last_heartbeat_at": "2026-07-09T12:05:26Z", "data_age_seconds": 4 }], "sequence_number": 12, "timestamp": "2026-07-09T12:05:30Z" }Live prices
Quotes and candles stream on the same socket. Price frames do not need an account subscribe first: send them for any account you own (an account you do not own returns 404 NotFoundError, as for subscribe). Price subscriptions do not report account connection changes, so also subscribe to the account to see them. Symbol names are case-sensitive and exactly as the broker shows them, for example EURUSD.r.
subscribe_quotes takes 1 to 50 symbols, subscribe_candles one symbol and one timeframe. MT4 accounts take M1, M5, M15, M30, H1, H4, D1, W1 and MN1. MT5 accounts also take M2, M3, M4, M6, M10, M12, M20, H2, H3, H6, H8 and H12.
{ "type": "subscribe_quotes", "account_id": "9b2c…", "symbols": ["EURUSD", "GBPUSD"], "request_id": "2c1d…" }{ "type": "subscribe_candles", "account_id": "9b2c…", "symbol": "EURUSD", "timeframe": "M5", "request_id": "3d2e…" }unsubscribe_quotes and unsubscribe_candles take the same fields and stop the feed. Every subscribe and unsubscribe is answered with a price_subscriptions frame listing what this socket now holds for the account, sorted:
{ "type": "price_subscriptions", "account_id": "9b2c…", "quotes": ["EURUSD", "GBPUSD"], "candles": [{ "symbol": "EURUSD", "timeframe": "M5" }], "request_id": "3d2e…" }quotes: the latest bid and ask of every subscribed symbol that changed. time is UTC with milliseconds:
{ "type": "quotes", "account_id": "9b2c…", "quotes": [{ "symbol": "EURUSD", "bid": 1.08534, "ask": 1.08536, "time": "2026-11-16T10:00:00.250Z" }], "sequence_number": 13, "timestamp": "2026-11-16T10:00:00Z" }candle: the forming bar of a subscribed stream whenever it changes, and once more with closed: true when the bar ends. candle.time is the bar's open in UTC and tickVolume counts the price changes in the bar:
{ "type": "candle", "account_id": "9b2c…", "symbol": "EURUSD", "timeframe": "M5", "closed": false, "candle": { "time": "2026-11-16T10:00:00Z", "open": 1.08520, "high": 1.08541, "low": 1.08518, "close": 1.08534, "tickVolume": 87 }, "sequence_number": 14, "timestamp": "2026-11-16T10:00:00Z" }A few rules for reading them:
- A new subscription starts with the latest stored values. Each newly subscribed symbol or stream first gets its latest quote or forming bar once, when the account has one stored, then the changes.
- Quotes are batched. Changed symbols arrive together, at most about 4 times a second per account. A slow reader gets the latest quote per symbol, not every tick, and the latest forming bar per stream. Price frames never block your position, order and deal frames.
- Closed bars are never dropped, and arrive at least once. De-duplicate on symbol, timeframe and
candle.time. A socket that lets more than 1,000 closed bars wait gets a final error frame and closes with code1008. - A candle
timeis the bar's open in UTC. A daily bar on a broker whose day closes at 17:00 New York opens at 22:00 UTC in US winter and 21:00 UTC in US summer, so a Monday bar opens on the Sunday evening before. - At most 50 price subscriptions per connection. Quote symbols and candle streams count together, across all accounts, apart from the 50 account subscriptions.
- Reconnect and resubscribe. Price subscriptions end with the connection.
Price frame errors come back as error frames with your request_id, and the socket stays open:
id | When |
|---|---|
| 400 | symbols is not a list of 1 to 50 names, symbol is missing, or timeframe is not one of the account's timeframes. |
| 404 | The account is not yours, or the broker has no symbol with this name: Symbol not found: EURUSD. Nothing is subscribed. |
| 429 | The subscribe would pass 50 price subscriptions. Nothing is subscribed. |
Prices work with Read Only keys and with accounts connected by investor password, and are included in the price of each account.
Sequencing and reconnect
Every server frame carries a sequence_number that increases by one, monotonically, for the life of the connection. Use it to detect dropped or out-of-order frames.
You do not have to repair gaps yourself. If the server detects an internal gap in its own upstream feed, it re-establishes the subscription and pushes a fresh snapshot in place (a new sync_id, followed by sync_started … sync_finished) without dropping your socket. You can also force this yourself at any time by sending { "type": "resync", "account_id": "9b2c…" }.
There is no client-side replay/backfill protocol in v1: after any reconnect, resubscribe and the server sends a fresh, complete snapshot.
Keepalive
The server sends an application-level ping every 30 seconds:
{ "type": "ping" }Reply promptly with { "type": "pong" }. After 2 consecutive missed pongs the server assumes the socket is dead, sends a final error frame, and closes with code 4408:
{ "type": "error", "id": 4408, "error": "ConnectionTimeout", "message": "Connection liveness timeout ( missed pongs)", "requestId": null }The Python and TypeScript SDKs answer pings for you; if you speak the protocol directly, you must send pong yourself.
Limits and errors
These caps apply:
| Limit | Value | On exceed |
|---|---|---|
| Connections per developer account (shared by all its API keys) | 5 | The new connection is accepted, sent an error frame, then closed with code 4429. The 5 live connections are untouched. |
| Subscriptions per connection | 50 | The 51st subscribe gets an error frame only; the socket and existing subscriptions stay up. |
| Price subscriptions per connection | 50 | The subscribe that would pass 50 gets an error frame only; nothing new is subscribed. |
| Size of a frame you send | 64 KB (65,536 characters), JSON text only | A larger or binary frame gets a 400 error frame only. A frame over 1 MiB closes the connection with code 1009. |
Error frames reuse the REST envelope fields (id, error, message, requestId) plus type: "error", with an optional details object. requestId echoes the request_id of the frame that triggered the error (or null for connection-level errors like auth and liveness):
{ "type": "error", "id": 429, "error": "TooManyRequestsError", "message": "Subscription limit exceeded", "requestId": "1f0a…" }Close codes
| Code | Meaning |
|---|---|
4401 | Authentication failed: missing, invalid, revoked, expired, or inactive key. Also sent to an open stream once its key is revoked or expires, or its API account is closed. |
4408 | Liveness timeout: too many missed pongs. |
4429 | Connection limit exceeded: your developer account already has 5 open connections. |
1008 | More than 1,000 closed candle bars were waiting to be sent: the client was not reading fast enough. |