How to subscribe to account data

Subscribe to account

{"id": 1, "type": "AccountStateSubscribe" , "body":{"interval": 250}}

Parameter interval defines after what time a request for information on the MT account will be made in ms:

  1. Request to MT for account data

  2. Message in queue

  3. Waiting for interval in ms

  4. Return to step 1

Response:

{"type": "AccountState", "body": {"balance":1000, "account": 87622, "equity": 1000, "credit": 0, "margin":0, "margin_level":0, "free_margin": 1000, "currency": "USD","orders":[], "pendings":[]}}

Unsubscribe is made by the following request:

{"id": 2, "type":"AccountStateUnsubscribe", "body": {}}

Last updated