Skip to content

Downgrade market data subscription#

About#

Notifies client that server have downgraded market data subscription due to amount of data generated by the subscription exceeds the rate limit quota.

For more information see AsyncApi documentation

Description#

This event is emitted by MetaApi in when server either reduces subscription interval or removes a market data subscription due to amount of data generated by the subscription exeeds the rate limit quota.

See Rate limiting for more information about rate limits.

The message below can be received from the synchronization event.

Name Type Required Description
type string Yes The value of this field will be downgradeSubscription
symbol string Yes The symbol subscription was downgraded for
updates Array Subscription updates
unsubscriptions Array List of removed subscriptions
accountId string Yes account id specified in the request

MarketDataSubscription fields#

Name Type Required Description
type string Yes subscription type, one of quotes, candles, ticks, or marketDepth
timeframe string when subscription type is candles, defines the timeframe according to which the candles must be generated. Allowed values for MT5 are 1m, 2m, 3m, 4m, 5m, 6m, 10m, 12m, 15m, 20m, 30m, 1h, 2h, 3h, 4h, 6h, 8h, 12h, 1d, 1w, 1mn. Allowed values for MT4 are 1m, 5m, 15m 30m, 1h, 4h, 1d, 1w, 1mn
intervalInMilliseconds integer defines how frequently the terminal will stream data to client. If not set, then the value configured in account will be used

MarketDataUnsubscription fields#

Name Type Required Description
type string Yes subscription type, one of quotes, candles, ticks, or marketDepth

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: 'subscribe',
  requestId: '57bfbc9f-108d-4131-a300-5f7d9e69c11b'
};

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

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

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

An example of a synchronization payload:

{
  "type": "subscriptionDowngraded",
  "updates": [{"type": "quotes", intervalInMilliseconds: 30000}],
  "accountId": "865d3a4d-3803-486d-bdf3-a85679d9fad2"
}