Skip to main content

6.3. API Layers

Layer 0 API

The purpose of L0 API is connectivity to exchanges, data vendors, and trading systems which are not yet supported.

Connecting via L0 opens full Bookmap functionality that is supported for built-in adapters. Typically, the development of a new adapter has two stages: data connectivity, and trading connectivity. The implementation of trading functionality is not mandatory and it can be implemented even partially, for instance, visualization of the evolution of trader's orders, but without the ability to send or modify them from Bookmap chart.

There are two distinct solutions that are based on L0 API: Quant solution (paid), and Connect solution (free).

Layer 1 API

L1 API allows for:

  • Fast access to real-time and recent historical data (stored in Bookmap’s data-structure) in a uniform format regardless of specific connection
  • Implementation of automated trading strategies
  • Record and/or export of market data and orders in any desired format

There are 3 built-in demo strategies Chase, Escape, and Execute which use L1 API. Users can activate them via the strategies button. Their main purpose is demonstration of L1 API custom modules and offering their source code as a reference for development of other custom modules. It's therefore recommended not to activate these demo strategies with a real trading account.

Note: L1 API gives the access to so-called Non-Display data, i.e. ability to access it not only in the visual form.

L1 API modules can be either attached or injected. Both methods receive complete market data and updates on status of user's orders when they arrive from the outside (i.e. via L0 API) even if the orders were initiated from outside Bookmap.

Inject method

Within the inject method both market data and user's orders pass through the custom module. This gives the custom module full control over the data flow including the ability to modify it. But it also puts on it the responsibility to forward the data further both ways. Here are use case examples:

  • Risk module that can override user actions on the chart
  • Display on the chart thousands of units instead of units by dividing the size by 1000.

Attach method

Within the attach method the custom module cannot modify the data received by the chart and cannot modify user's trading actions on the chart. Instead, it listens to the market data updates and to user's actions on the chart. While it cannot block or modify trader's actions on the chart before they leave Bookmap, it will still receive status updates of user actions once they come back from the exchange or from OMS (e.g. from Rithmic) and can therefore generate its own automatic actions in response to market data or user's actions. Here are use case examples:

  • Record market data in a custom format or export it in real-time, e.g. into Excel
  • Automatic data driven trading strategy
  • Custom alerts for specific market data or trading conditions

Developing Indicators

As a part of the Bookmap level 1 API, users can develop indicators that are displayed over the heatmap or in the indicators panel below it.

Note:

  • Indicators are just a part of a strategy. Any strategy can register any number of indicators.
  • Indicators can be displayed over the main chart or over the bottom panel. An indicator can optionally be displayed as a widget as well, as shown in the example below.

Insert screenshot

A strategy that uses widgets is required to implement the OnlineCalculatable interface which contains two important methods:

  • calculateValuesInRange this one will be called when your indicator needs data for a specific time range. Usually it happens when the user moves the heatmap around. This method does not necessarily have to be very fast. If you need to make complex computations, you will be able to provide values one-by-one and the user will see the computed part of the graph. In this method, you will usually request aggregated data from a storage and process it.

  • createOnlineValueCalculator this one is intended for calculating indicator values in real time. You will have to provide a calculator that will react on incremental updates, recomputing the last value as necessary.