Skip to content

Read symbol specification#

About#

Retrieves specification for a symbol

For more information see Async api documentation

Request#

In order to retrieve a symbol specification, your application needs to emit request event with the following payload.

Name Type Required Description
type string Yes request type, must be getSymbolSpecification if you want to retrieve a symbol specification
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
symbol string Yes symbol (e.g. currency pair or an index)

Response#

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
specification object Yes MetaTrader symbol specification. Symbol specification schema: MetatraderSymbolSpecification

Code example#

import ioClient from 'socket.io-client';

const socket = ioClient('https://mt-client-api-v1.new-york.agiliumtrade.ai', {
    path: '/ws',
    reconnection: false,
    query: {
        'auth-token': 'token'
    }
});

const request =  {
    accountId: '865d3a4d-3803-486d-bdf3-a85679d9fad2',
    type: 'getSymbolSpecification',
    requestId: '60440b68-f098-4f9e-b9d0-ec7149979ec9',
    symbol: 'EURUSD'
};

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

socket.on('response', response => {
  console.log(response);
});

socket.on('processingError', err => {
  console.error(err);
});

Response example#

{
  "type": "response",
  "requestId": "60440b68-f098-4f9e-b9d0-ec7149979ec9",
  "accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2",
  "specification": {
    "symbol": "AUDNZD",
    "tickSize": 0.00001,
    "minVolume": 0.01,
    "maxVolume": 100,
    "volumeStep": 0.01,
    "contractSize": 100000,
    "quoteSessions": {
      "SUNDAY": [],
      "MONDAY": [{"from": "00:00:00.000", "to": "23:59:59.999"}],
      "TUESDAY": [{"from": "00:00:00.000", "to": "23:59:59.999"}],
      "WEDNESDAY": [{"from": "00:00:00.000", "to": "23:59:59.999"}],
      "THURSDAY": [{"from": "00:00:00.000", "to": "23:59:59.999"}],
      "FRIDAY": [{"from": "00:00:00.000", "to": "23:59:59.999"}],
      "SATURDAY": []
    },
    "tradeSessions": {
      "SUNDAY": [],
      "MONDAY": [{"from": "00:05:00.000", "to": "23:59:59.999"}],
      "TUESDAY": [{"from": "00:05:00.000", "to": "23:59:59.999"}],
      "WEDNESDAY": [{"from": "00:05:00.000", "to": "23:59:59.999"}],
      "THURSDAY": [{"from": "00:05:00.000", "to": "23:59:59.999"}],
      "FRIDAY": [{"from": "00:05:00.000", "to": "23:59:59.999"}],
      "SATURDAY": []
    },
    "initialMargin": 100000,
    "maintenenceMargin": 0,
    "hedgedMargin": 0,
    "priceCalculationMode": "SYMBOL_CALC_MODE_FOREX",
    "marginCurrency": "AUD",
    "baseCurrency": "AUD",
    "profitCurrency": "NZD",
    "swapMode": "SYMBOL_SWAP_MODE_DISABLED",
    "allowedExpirationModes": ["SYMBOL_EXPIRATION_GTC", "SYMBOL_EXPIRATION_DAY", "SYMBOL_EXPIRATION_SPECIFIED", "SYMBOL_EXPIRATION_SPECIFIED_DAY"],
    "allowedOrderTypes": ["SYMBOL_ORDER_MARKET", "SYMBOL_ORDER_LIMIT", "SYMBOL_ORDER_STOP", "SYMBOL_ORDER_STOP_LIMIT", "SYMBOL_ORDER_SL", "SYMBOL_ORDER_TP", "SYMBOL_ORDER_CLOSEBY"],
    "digits": 5,
    "description": "Australian Dollar vs New Zealand Dollar"
  }
}