Skip to content



Notifies of a change in terminal state.

For more information see AsyncApi documentation


This event is emitted by MetaApi in following situations:

  • position changes
  • open order changes
  • history order changes
  • history deal changes

The message below can be received from the synchronization event.

Name Type Required Description
type string Yes The value of this field will be status
accountId string Yes account id specified in the request
updatedPositions array updated positions. Schema Array<MetatraderPosition>
removedPositionIds array removed position ids (array of numbers)
updatedOrders array updated orders. Schema Array<MetatraderOrder>
completedOrderIds array completed order ids (array of numbers)
historyOrders array new completed orders added to order history. Schema Array<MetatraderOrder>
deals array new history deals. Schema Array<MetatraderDeal>
sequenceNumber number Yes an ordinal number of the packet. Increases by 1 with each new packet. Starts with 0 in every new session. Can be used to check for packet loss during synchronization.
sequenceTimestamp number Yes an ordinal number of packets, but this field is increased by a random number in each new packet. Always increases regardless of the session.

Code example:

import ioClient from '';

const socket = ioClient('', {
    path: '/ws',
    reconnection: false,
    query: {
        'auth-token': 'token'

const request = {
  accountId: '865d3a4d-3803-486d-bdf3-a85679d9fad2',
  type: 'synchronize',
  requestId: '57bfbc9f-108d-4131-a300-5f7d9e69c11b',
  startingDealTime: '2019-01-13T10:29:26.000Z',
  startingHistoryOrderTime: '2019-01-13T10:29:26.000Z'

socket.on('connect', () => {
  socket.emit('request', request);

socket.on('synchronization', data => {
  if (data.type === 'authenticated') {
    request.requestId = uuid.v4();
    socket.emit('request', request);

socket.on('processingError', err => {

An example of a synchronization payload:

  "type": "status",
  "removedPositionIds": [
  "accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2"