Introduction
Purpose
The QST Binary Order Routing API provide a set of requests to managing your order entry account, place and cancel different types of orders, get account information, track order activity and subscribe to streaming of order entry notification updates. The contents of the WebSocket messages are serialized using Google Protocol Buffers.
Types of messages
Request messages
These are messages sent from the client to the server. 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 second request will be login directly in Order Entry, and it is OELoginRequest
, we are the same wait for response, but now OELoginResponse
will inform about successful/unsuccessful login process.
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 and has a type AsyncServerMessage. For the Order Entry service, server sent only one type of message and it is OrderEntryNotification, these message are order entry notification, that can contain account, order, netPosition, text information. The list of all field of notification message can be found here: Async Messages
General Workflow and Client Example
When using this API the client needs to implement the following workflow:
Send a LoginRequest.
Receive a
LoginResponse
and make sure the login was successful.
Send a OELoginRequest.
Receive a
OELoginResponse
with list of available accounts if login was successfully or error message in another case.
After successful login, send OrderBookRequest to load order book for account.
Receive a
OrderBookResponse
and check if orders book is not empty.
Send ChangeOALSubscriptionLevelRequest to subscribe order activity updates.
Send a PlaceOrderRequest with order data, to place order for selected account.
Send a OrderBookRequest to get the id of last placed request.
Send a CancelOrderRequest with order id, to cancel earlier placed request.
Send few (3 or more) PlaceOrderRequest for test multiple cancel order requests.
Send CancelOrdersRequest for cancel all working orders.
Send few (3 or more) PlaceOrderRequest with the same instrument name, for test multiple cancel order for contract request.
Send CancelOrdersForContractRequest with needed contract name, to cancel all orders for contract.
Send a PlaceOrderRequest with order data, to place order for selected account.
Send a CancelReplaceOrderRequest with order id that need replaced, and new order data.
Send a OrderBookRequest to get updated list of orders.
Send a GetActivityItemsRequest for track history of order actions.
Receive a
GetActivityItemsResponse
with list of order activity.
Send a AccountInfoRequest to get detail information about current account.
Receive
AccountInfoResponse
.
Send a OESwitchAccountRequest with account id, for connect in another Order Entry account to manager orders.
Receive
OESwitchAccountResponse
with new account id.
Send a OELogoutRequest to logout from Order Entry service.
Send a LogoutRequest to terminate the session gracefully.
Client Example
Coming soon: a minimal client implementation with Angular and TypeScript around Websockets implemented order entry service, to control the connection, order management, notification subscription and provision of dedicated UI to test each request presented.
Disconnect Reasons
The list can be found here: Disconnect Reasons