Specifications#
About#
Notifies of a change in the specification.
For more information see Async api documentation
Description#
This event is emitted by MetaApi in following situations:
- upon initial synchronization
- whenever a consumer subscribes to market data
The message below can be received from the synchronization
event.
Name | Type | Required | Description |
---|---|---|---|
type | string | Yes | The value of this field will be specifications |
synchronizationId | string | No | Id of the synchronization request |
specifications | array | Yes | Specifications array. Response schema: Array<MetatraderSymbolSpecification> |
accountId | string | Yes | account id specified in the request |
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 'socket.io-client';
const socket = ioClient('https://mt-client-api-v1.agiliumtrade.agiliumtrade.ai', {
path: '/ws',
reconnection: false,
query: {
'auth-token': 'token'
}
});
const request = {
accountId: '865d3a4d-3803-486d-bdf3-a85679d9fad2',
type: 'synchronize',
requestId: '57bfbc9f-108d-4131-a300-5f7d9e69c11b'
};
socket.on('connect', () => {
socket.emit('request', request);
});
socket.on('synchronization', data => {
console.log(data);
});
socket.on('processingError', err => {
console.error(err);
});
An example of a synchronization payload:
{
"type": "specifications",
"synchronizationId": "57bfbc9f-108d-4131-a300-5f7d9e69c11b",
"specifications": [
{
"symbol": "EURUSD",
"tickSize": 0.00001,
"minVolume": 0.01,
"maxVolume": 200,
"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"
}
],
"accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2"
}