Skip to content

Read position by id#


Returns specific position for a MetaTrader account

For more information see Async api documentation


In order to retrieve specific position, your application needs to emit request event with the following payload.

Name Type Required Description
type string Yes request type, must be getPosition if you want to retrieve specific position
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
positionId string Yes position id (ticket number)


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
position object Yes Position for a specified MetaTrader account. Response schema: MetatraderPosition

Code example#

import ioClient from '';

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

const request = {
    accountId: '23ccdd23-0b8a-400d-9aba-0129de365ba9',
    type: 'getPosition',
    requestId: '1cadfa6d-d604-4794-a9dd-c7e01b9810c8',
    positionId: '46214692'

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

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

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

Response example#

  "type": "response",
  "requestId": "1cadfa6d-d604-4794-a9dd-c7e01b9810c8",
  "position": {
    "id": "46214692",
    "type": "POSITION_TYPE_BUY",
    "symbol": "GBPUSD",
    "magic": 1000,
    "time": "2020-04-15T02:45:06.521Z",
    "brokerTime": "2020-04-15 05:45:06.521",
    "openPrice": 1.26101,
    "currentPrice": 1.24948,
    "currentTickValue": 1,
    "volume": 0.07,
    "swap": 0,
    "profit": -80.71000000000093,
    "updateTime": "2020-04-15T02:45:06.521Z",
    "commission": -0.25,
    "clientId": "TE_GBPUSD_7hyINWqAlE",
    "stopLoss": 1.17721,
    "unrealizedProfit": -80.71000000000028,
    "realizedProfit": -6.536993168992922e-13
  "accountId": "23ccdd23-0b8a-400d-9aba-0129de365ba9"