Skip to content

TRACK_MBOOK Command

This command must be sent to TCP/77. Once received, MTsocketAPI will initiate Depth of Market (DOM) streaming over the data port, which defaults to TCP/78:

Help
{
   "MSG":"HELP",
   "COMMAND":"TRACK_MBOOK",
   "DESCRIPTION":"Receive Market Depth in realtime for the subscribed symbols",
   "MANDATORY_TAGS":[
      "SYMBOLS (ARRAY STRING)"
   ],
   "OPTIONAL_TAGS":[
      null
   ]
}

Example

Single Line command (necessary for MTsocketAPI):

{"MSG":"TRACK_MBOOK", "SYMBOLS":["EURUSD"]}

Same command in Beauty Format:

{
    "MSG":"TRACK_MBOOK",
    "SYMBOLS":["EURUSD"]
}
MTsocketAPI reply:

{
    "MSG":"TRACK_MBOOK",
    "SUCCESS":["EURUSD"],
    "ERROR_ID":0,
    "ERROR_DESCRIPTION":"The operation completed successfully"
}

Now we can connect to default TCP 78 port to see the data:

$ telnet localhost 78
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
{"MSG":"TRACK_MBOOK","SYMBOL":"EURUSD","MARKET_BOOK":[{"PRICE":1.08467,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08464,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08463,"VOLUME":12,"VOLUMEREAL":12.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08462,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08459,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08458,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08455,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08454,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08453,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08450,"VOLUME":11,"VOLUMEREAL":11.00,"TYPE":"BOOK_TYPE_BUY"}]}
{"MSG":"TRACK_MBOOK","SYMBOL":"EURUSD","MARKET_BOOK":[{"PRICE":1.08472,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08467,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08464,"VOLUME":20,"VOLUMEREAL":20.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08462,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08459,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08458,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08455,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08454,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08453,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08451,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"}]}
{"MSG":"TRACK_MBOOK","SYMBOL":"EURUSD","MARKET_BOOK":[{"PRICE":1.08472,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08467,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08464,"VOLUME":20,"VOLUMEREAL":20.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08462,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08459,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08458,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08455,"VOLUME":15,"VOLUMEREAL":15.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08453,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08450,"VOLUME":11,"VOLUMEREAL":11.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08446,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_BUY"}]}
{"MSG":"TRACK_MBOOK","SYMBOL":"EURUSD","MARKET_BOOK":[{"PRICE":1.08467,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08464,"VOLUME":20,"VOLUMEREAL":20.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08463,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08462,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08459,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08458,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08455,"VOLUME":15,"VOLUMEREAL":15.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08453,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08450,"VOLUME":11,"VOLUMEREAL":11.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08446,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_BUY"}]}
{"MSG":"TRACK_MBOOK","SYMBOL":"EURUSD","MARKET_BOOK":[{"PRICE":1.08472,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08467,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08464,"VOLUME":20,"VOLUMEREAL":20.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08462,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08459,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_SELL"},{"PRICE":1.08458,"VOLUME":2,"VOLUMEREAL":2.50,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08456,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08455,"VOLUME":5,"VOLUMEREAL":5.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08453,"VOLUME":10,"VOLUMEREAL":10.00,"TYPE":"BOOK_TYPE_BUY"},{"PRICE":1.08450,"VOLUME":11,"VOLUMEREAL":11.00,"TYPE":"BOOK_TYPE_BUY"}]}
Important

You must request DOM data using the port TCP/77 and MTsocketAPI will stream Market Depth data on port TCP/78.

Tip

You can connect multiple clients to TCP/78 port and all of them will receive DOM data.