How to subscribe to instruments

Subscribe to instruments

Request:

{"id": 11, "type":"TicksSubscribe", "body": {"symbol":"EURUSD.s,BTCUSD.s", "interval": 1}}

Response

{"type": "TicksSubscribe", "id":11, "body": {"symbol": "EURUSD.s,BTCUSD.s"}}

How it works:

  1. tick comes from MT

  2. the current time is taken

  3. if the difference between the current time and the previous message by tick of this instrument is less than interval in ms:

    1. then the tick is ignored

    2. otherwise the message was written to the queue

  4. waiting for the next tick

Request the list of subscription

Request:

{"id": 111, "type":"TicksSubscriptions", "body": {}}

Response:

{"type": "TickSubscribed", "id":111, "body": {"symbol":"BTCUSD.s,EURUSD.s"}}

Unsubscribe to instrument

Request:

Response:

Changes in the settings of trading instruments

When you change the following settings, you receive a notification about changing the symbol parameters.

You can go through this example (screenshots from Metatrader 5 Administrator):

Changes of any values in the previous screen leads to a change in the symbol parameters and triggers a notification from the MT5 side.

It is better to restart RW-Manager in any changes of symbol parameter to avoid the problem of data caching by the MT5APIManager64.dll library. (Also you can read about restart of RW-Manager - here.)

Last updated