MetaTrader®, MT4® and MT5® are trademarks of MetaQuotes Ltd. This is an independent service and is not affiliated with, authorized by, or endorsed by MetaQuotes. Trustpilot4.0
EN
LIVE · WebSocket streaming

Stream MT4 & MT5 prices in real time — one WebSocket, no polling loop.

Subscribe to any symbol and get its price changes pushed as they arrive — at most one quote every 200 ms per symbol. Positions with live profit, pending orders, executed trades and connection state come over the same socket — no request loops, and streaming doesn't spend your REST request budget.

wss://api.metatraderapi.net/v1/stream · MT4 + MT5 · JSON frames
Works with every MT4 & MT5 broker Up to 25 streams per account Quotes · positions · trades · connection state Also on REST & gRPC
// what it is

A push feed for live MetaTrader market data.

The MetaTrader WebSocket API lets any application subscribe to a live MT4 or MT5 account and receive market data as a continuous stream instead of repeatedly asking for it. You open one connection to wss://api.metatraderapi.net/v1/stream, send a subscribe message per symbol, and the server pushes a JSON frame when the price changes (at most one per 200 ms per symbol) — bid, ask, last, real volume and trade flags — plus positions with live profit, pending orders, executed trades and a connection-state heartbeat on the same socket. It removes the polling loop that makes REST-based quote apps slow, expensive and always a step behind the market.

// polling vs streaming

Why not just poll a REST quote endpoint?

Because the market moves between your requests. Streaming pushes price changes as they arrive (up to five quotes a second per symbol); polling gives you snapshots with gaps — and burns requests doing it.

REST POLLING The old way

  • You ask "what's the price?" 10× a second and hope you didn't miss a spike between calls.
  • Thousands of wasted requests when nothing changed.
  • Latency = your polling interval. Fast enough hits rate limits.

WEBSOCKET With streaming

  • Price changes are pushed as they arrive — at most one quote every 200 ms per symbol.
  • One connection, many symbols. Frames don't count as REST requests.
  • Positions, orders, executed trades and connection state on the same socket.
// three lines to live data

Live data in three steps.

1

Get a key

Connect an MT4/MT5 account in the dashboard and copy its API key.

2

Open the socket

Point a WebSocket at wss://api.metatraderapi.net/v1/stream with your key and account id.

3

Subscribe

Send {action:"subscribe",symbol:"EURUSD"} and read the frames.

stream.js — live quotes in the browser or Node
// One socket, pushed quotes — no polling loop. Browsers pass ?apiKey=; servers send the x-api-key header.
const ws = new WebSocket("wss://api.metatraderapi.net/v1/stream?id=<accountId>&apiKey=mt5api_…");

ws.onopen = () => {
  ws.send(JSON.stringify({ action:"subscribe", symbol:"EURUSD" }));
  ws.send(JSON.stringify({ action:"subscribe", symbol:"XAUUSD" }));
};

ws.onmessage = (e) => {
  const f = JSON.parse(e.data);
  // { type:"QUOTE", data:{ symbol:"EURUSD", bid:1.16395, ask:1.16403,
  //   timeMsc:1788975235949, last:0.0, volumeReal:0 } }
  if (f.type === "QUOTE") console.log(f.data.symbol, f.data.bid, f.data.ask);
};
// who it's for

Built for anyone who can't wait for the next poll.

Trading dashboards

Live price charts and blotters that update as the price changes, without hammering an endpoint.

→ SaaS & fintech builders

Algo & signal bots

Fire strategy logic on each pushed quote, not on a timer. TRADE frames report every executed deal.

→ Algorithmic traders

Price alerts & copy tools

Watch dozens of symbols on one connection and react to level crossings as the quotes arrive.

→ Alert & copy-trading services
// the numbers

One socket does the work of thousands of requests.

1
connection streams every symbol on the account
25/acct
concurrent streams per MT4/MT5 account
200 ms
at most one quote per symbol — pushed on change
// questions

Frequently asked

What is the MetaTrader WebSocket API?+
It is a real-time streaming interface to a live MT4 or MT5 account. You open one WebSocket to wss://api.metatraderapi.net/v1/stream, subscribe to symbols, and receive JSON frames for quote changes (at most one per 200 ms per symbol), positions, orders, executed trades and connection state — instead of polling a REST endpoint.
How is streaming different from the REST quotes endpoint?+
REST returns one snapshot per request, so you only see the price at the moments you ask, and you spend a request each time. The WebSocket pushes price changes automatically as they arrive (at most one quote per 200 ms per symbol) — no polling loop and no per-quote request cost.
Does it work with both MT4 and MT5?+
Yes. The same streaming surface covers MT4 and MT5 accounts, and works with any broker, because it drives a real MetaTrader session logged into your account.
What data does each quote frame contain?+
Each QUOTE frame carries the symbol, bid, ask, last price, volume, real volume, millisecond timestamps (timeMsc, plus UTC fields) and trade flags — enough to build tick charts, VWAP or microstructure analytics.
Can I get trade events and connection status on the same socket?+
Yes. Positions with live profit, pending orders and executed trades (opens, closes, SL/TP hits) are pushed without any subscription, and a heartbeat every 10 seconds reports the connection state, all over the one connection.
Is there a REST or gRPC option too?+
Yes. The same account is reachable over REST for request/response calls and gRPC for typed, high-throughput clients, using the same API key. Use whichever fits your app.
Create account

Point a WebSocket at your account and watch it tick.

Connect an MT4 or MT5 account, grab your key, and stream live prices in three lines of code.