Introduction

Purpose

The QST Binary Market Data API allows a client to request instrument definitions and subscribe to streaming market data updates using either the WebSocket Secure (wss) or WebSocket protocol. A complete specification of the WebSocket and WebSocket Secure protocols can be found in IETF RFC 6455. The contents of the WebSocket messages are serialized using Google Protocol Buffers.

Note

The code examples in this documentation are in the JavaScript programming language.


QST Binary Market Data API Protobuf file

The message definitions file:

Types of messages

Request messages

These are messages sent from the client to the server. Each request message has a request_id which should uniquely identify a client’s request. The request_id should be populated by the client and it will be returned by the server in the response message. In this way the client can match the responses to the corresponding requests. There is no guarantee that the responses will be received in the order in which the requests are sent, unless the client decides to not send a request until after it received the response to its previous request. The client’s first request must be a LoginRequest and the client must not send any other request until after it receives a LoginResponse indicating a successful login.

The list of supported requests is this:


Server messages

These are messages sent from the server to the client. There are 2 types of server messages:

Response Messages

These are sent from the server to the client as responses to request messages sent by the client. Each client request will receive one server response

Asynchronous Messages

These messages are pushed from the server to the client asynchronously. Most of these messages are market data updates and also instrument definitions. The list of all supported async messages can be found here: Async Messages


Quotes Coalescing

In many use cases, the clients cannot keep up with the flow of market data updates coming from the exchange, therefore it is strongly recommended that the client asks for the server to coalesce the asynchronous quote messages over a period of time specified in the login request. When coalescing is enabled, the server will only send updates to the client at the specified time interval if there were any updates during this time interval. Even a coalesce time of a few hundreds of milliseconds could significantly reduce the number of messages that the client will receive and have to process.

To use coalescing, please check the UserPreferences fields section from the LoginRequest.


General Workflow and Client Example

When using this API the client needs to implement the following workflow:

    1. Send a LoginRequest.

    1. Receive a LoginResponse and make sure the login was successful.

    1. Send a ProductInfoRequest and receive a list of supported products.

    1. Send one or more InstrumentDefinitionRequest messages to request definitions of the instruments that the client is interested in. The client could skip this step if it already knows the internal QST instrument IDs of the instruments that it wants to subscribe to.

    1. Send one or more SnapshotQuoteRequest or SubscribeQuoteRequest messages for the instruments that the client is interested in and build the market data statistics and order books from the responses received for those requests.

    1. Wait for AsyncQuotes messages for the instruments queried in step 5. Please note that a SnapshotQuoteRequest will only generate a one-time response, and it is not followed by AsyncQuotes.

    1. Send UnsubscribeQuoteRequest when no longer interested in the market data for some instruments.

    1. Send a LogoutRequest to terminate the session gracefully.

Client Example

Here is a minimal client implementation in javascript. The client can use the source files to see how the requests are created and how the responses are handled.


Disconnect Reasons

The list can be found here: Disconnect Reasons


Revisions

This subchapter keeps track of the changes done to this documentation over the time.

03/07/2022

  • Add support for Indicative opening price for quote.

02/17/2022

  • Add note for expired contracts for SnapshotQuoteRequest and SubscribeQuoteRequest documentation.

01/11/2022

  • Add DomBookSnapshot for AsyncQuote instead of DomBook.

09/27/2021

  • Add suport for asynchronous instrument definitions and productInfo.

09/01/2021

  • Add suport for SnapshotQuoteRequest.

08/27/2021

  • Add suport for TranslateProductSymbolRequest.

08/18/2021

  • Updated the values of BookAction from AsyncQuotes.

06/03/2021

  • Updated UserPreferences from LoginRequest.

12/15/2020

  • Added client example.

  • Added examples for applying the quotes.

11/06/2020

  • Initial Version