Node.js
Node 18+ has fetch built in. Node 22+ also has a global WebSocket; on older versions use the ws package.
All examples assume the EA is running on the same computer with default ports. Order examples are for demo accounts.
Get a price and send an order
Section titled “Get a price and send an order”const API = "http://127.0.0.1:81";
const q = await fetch(`${API}/v1/quote?symbol=EURUSD`).then((r) => r.json());console.log(q.BID, q.ASK);
const o = await fetch(`${API}/v1/order?symbol=EURUSD&volume=0.01&type=ORDER_TYPE_BUY`, { method: "POST" }).then((r) => r.json());console.log(o.RETCODE, o.ORDER, o.ERROR_DESCRIPTION);Stream OHLC bars
Section titled “Stream OHLC bars”await fetch(`${API}/v1/track/ohlc`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ OHLC: [{ TIMEFRAME: "PERIOD_M5", SYMBOL: "EURUSD", DEPTH: 1 }] }),});const ws = new WebSocket("ws://127.0.0.1:81");ws.onmessage = (e) => console.log(JSON.parse(e.data));