Documentation

Ticks

DataNo Auth

Stream real-time ticks for one or more symbols. Unchanged in the New API.

Quick comparison

AspectLegacy APINew APIAction
EndpointticksticksNone
Auth RequiredNoNoNone
Symbol pattern^\w{2,30}$^\w{2,30}$None
Subscribe values1 only1 onlyNone
tick objectOptionalOptionalNone
pip_sizeRequiredRequiredNone

Request and response fields

Request

  • ticks (required): a symbol that matches ^\w{2,30}$, or an array of symbols.
  • subscribe (optional): accepts only 1. Sends an update each time a new tick arrives.
  • passthrough (optional): data returned to you in echo_req.
  • req_id (optional): an ID that maps the response to your request.

Response

  • echo_req and msg_type (tick): always returned.
  • tick: only pip_size is guaranteed. ask, bid, epoch, id, quote and symbol are optional.
  • subscription.id: returned when you subscribe. Pass it to forget to stop the stream.
  • req_id: returned when you send one.

Request structure

Legacy APIrequest example
{
  "ticks": "frxEURUSD",
  "subscribe": 1
}
New APIrequest example
{
  "ticks": "frxEURUSD",
  "subscribe": 1
}

Response structure

Legacy APIresponse example
{
  "echo_req": {
    "ticks": "frxEURUSD",
    "subscribe": 1
  },
  "msg_type": "tick",
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  },
  "tick": {
    "ask": 1.08501,
    "bid": 1.08499,
    "epoch": 1760000000,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "pip_size": 5,
    "quote": 1.085,
    "symbol": "frxEURUSD"
  }
}
New APIresponse example
{
  "echo_req": {
    "ticks": "frxEURUSD",
    "subscribe": 1
  },
  "msg_type": "tick",
  "subscription": {
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3"
  },
  "tick": {
    "ask": 1.08501,
    "bid": 1.08499,
    "epoch": 1760000000,
    "id": "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "pip_size": 5,
    "quote": 1.085,
    "symbol": "frxEURUSD"
  }
}

Code examples

let streamId;

function subscribeTicks(symbol) {
  ws.send(JSON.stringify({ ticks: symbol, subscribe: 1 }));
}

ws.onmessage = (event) => {
  const response = JSON.parse(event.data);
  if (response.error) {
    console.error(response.error.message);
    return;
  }
  if (response.msg_type !== 'tick' || !response.tick) return;

  const { tick, subscription } = response;
  if (subscription) streamId = subscription.id; // pass to forget to stop the stream

  // pip_size is the only tick field the schema guarantees
  if (tick.symbol !== undefined && tick.quote !== undefined) {
    console.log(tick.symbol, tick.quote.toFixed(tick.pip_size));
  }
};
Click to open live chat support. Get instant help from our support team.