3.14.2Order book

Order book - where available - is handled very similarly in the framework to market depth. This section mostly describes the differences rather than repeating identical information.

The key differences are as follows:

The order book may include entries on both sides of the current price - users' stop orders as well as limits - whereas market depth will only have entries at and "below" the current price.

The back-end system may list the order book as any of the following: every individual order, or aggregated totals of the orders at each price, or aggregated totals for bands of prices such as 0.0010. In the two latter cases the order-book messages from the framework will have a granularity property, such as 0.00001 or 0.0010.

The volumes in the order book may not be normal trading volumes; they may be a different kind of value such as percentages of the total open volume. You can only rely on the volume figures having meaning relative to each other; you cannot rely on each one having independent validity in relation to the market's contractSize.

Order book for a market must be requested, using Framework.RequestOrderBook(), and terminated when no longer needed, using Framework.TerminateOrderBook().

The parameters for RequestOrderBook() are the same as RequestMarketDepth(): an instrumentId, an optional request ID, and an optional message handler (instead of processing the messages in OnMessage).

You should terminate requests when you no longer need them, using Framework.TerminateOrderBook(). The function takes two parameters: the instrument ID, and the request ID allocated either by you or the framework.

The ORDER_BOOK response messages, in an asynchronous handler or in OnMessage(), are identical to the MARKET_DEPTH responses described above. The message contains the changes plus the full current book.

ORDER_BOOK responses have one further property, as mentioned above:

Property

Description

granularity

Level of aggregation applied by the back-end system. If granularity:null, then the back-end system should be providing the full list of orders (including multiple orders at the same price). Otherwise, the back-end system is combining orders into aggregated amounts at different price points.