Skip to content

Read deals by ticket#


Returns history deals with a specific ticket number

For more information see Async api documentation


In order to retrieve history deals by a ticket, your application needs to emit request event with the following payload.

Name Type Required Description
type string Yes request type, must be getDealsByTicket if you want to retrieve deals by ticket
accountId string Yes MetaTrader account id. You can retrieve account id from Web application after you add your MetaTrader account to our platform. The account id can also be obtained via Provisioning API
requestId string Yes request id which your application must supply. Request id must be unique during an API connection
application string MetaApi application id. Default is RPC
ticket string Yes ticket number (deal id for MT5 or order id for MT4)


After executing your request the API server will emit response event with the following payload.

Name Type Required Description
type string Yes The value of this field will be response in the response to the above request
requestId string Yes request id the response relates to
accountId string Yes account id specified in the request
deals array Yes History deals with requested ticket number for a specified MetaTrader account. Response schema: Array<MetatraderDeal>
synchronizing boolean Yes If this field is true, this means that the data synchronization with the terminal is not yet complete and the data may not be accurate

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: 'getDealsByTicket',
    ticket: '33230099',
    requestId: '15bf7f0b-e09d-4df7-90ba-ca8c38ad802d'

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

socket.on('response', response => {

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

Response example#

  "type": "response",
  "requestId": "15bf7f0b-e09d-4df7-90ba-ca8c38ad802d",
  "synchronizing": false,
  "deals": [
      "clientId": "TE_GBPUSD_7hyINWqAlE",
      "commission": -0.25,
      "entryType": "DEAL_ENTRY_IN",
      "id": "33230099",
      "magic": 1000,
      "platform": "mt5",
      "orderId": "46214692",
      "positionId": "46214692",
      "price": 1.26101,
      "profit": 0,
      "swap": 0,
      "symbol": "GBPUSD",
      "time": "2020-04-15T02:45:06.521Z",
      "brokerTime": "2020-04-15 05:45:06.521",
      "type": "DEAL_TYPE_BUY",
      "volume": 0.07
  "accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2"