Skip to content

TRACK_PRICES Command

This command must be sent to TCP/77. Once received, MTsocketAPI will initiate price streaming over the data port, which defaults to TCP/78:

Help
{
    "MSG":"HELP",
    "COMMAND":"TRACK_PRICES",
    "DESCRIPTION":"Receive prices in real-time for the subscribed symbols",
    "MANDATORY_TAGS":["SYMBOLS (ARRAY STRING)"],
    "OPTIONAL_TAGS":[null]
}

Example

Single Line command (necessary for MTsocketAPI):

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

Same command in Beauty Format:

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

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

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

$ telnet localhost 78
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:35","SYMBOL":"EURUSD","ASK":1.08594,"BID":1.08592,"VOLUME":16246}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:35","SYMBOL":"EURUSD","ASK":1.08595,"BID":1.08592,"VOLUME":16247}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:36","SYMBOL":"EURUSD","ASK":1.08594,"BID":1.08592,"VOLUME":16248}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:37","SYMBOL":"EURUSD","ASK":1.08595,"BID":1.08592,"VOLUME":16249}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:40","SYMBOL":"EURUSD","ASK":1.08598,"BID":1.08596,"VOLUME":16249}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:41","SYMBOL":"EURUSD","ASK":1.08599,"BID":1.08596,"VOLUME":16251}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:42","SYMBOL":"EURUSD","ASK":1.08597,"BID":1.08595,"VOLUME":16252}
{"MSG":"TRACK_PRICES","TIME":"2022.04.12 08:16:42","SYMBOL":"EURUSD","ASK":1.08599,"BID":1.08597,"VOLUME":16253}
Note

You must request tick data using the port TCP/77 and MTsocketAPI will stream prices on port TCP/78.

Tip

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