> For the complete documentation index, see [llms.txt](https://tradesync.gitbook.io/tradesync/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tradesync.gitbook.io/tradesync/examples-of-using/how-to-subscribe-to-account-data.md).

# How to subscribe to account data

### Subscribe to account

```json
{"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:

```json
{"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:

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