6.1. General API Information
Bookmap API allows to connect to Bookmap new data sources and trading systems, and to develop custom modules such as automated trading strategy, indicators, voice alerts, data export and recording, and more. The API was developed by Bookmap team which has experience with dozens of API's of trading platforms, data vendors, and exchanges. The resulting API combines unprecedented levels of both simplicity and transparency. This gives users an ability to develop within minutes or hours custom modules which receive truly unfiltered and unaggregated market data (including full market depth) and may use complete trading functionality.
To get your account enabled for Bookmap API, use the custom strategies and indicators icon above the chart. It contains several sample strategies which users can configure. It also allows importing additional custom strategies or indicators developed via the API. The source for few of the sample strategies can be found at https://github.com/BookmapAPI/DemoStrategies.
- To edit the sample strategies to gain closer understanding of the API, their embedded version needs to be removed from Bookmap.
- To remove the embedded versions, close Bookmap, then go to C:\Program Files (x86)\Bookmap\lib and delete "bm-strategies.jar", then restart Bookmap. The custom strategies and indicator button should remain in place, but sample strategies should not appear there.
Now you will need Eclipse for Java to develop and edit your strategy. Note that you need to use a 32-bit JRE to run Bookmap with your strategy from Eclipse. Technically, any IDE will do, but we will use Eclipse for our example. Import the project into workspace. If you see errors, please check that you have the build path of the project configured correctly:
Insert screenshot
These settings should be there out of the box, but if not they need to be configured. Now, you should be able to export the strategy as a Jar file. Once exported, import the jar into Bookmap. You should see this window:
Insert screenshot
Each line item on the list represents a strategy. You can develop your strategy by editing the project and importing new jar files, but that may not be very convenient. An easier way would be to perform the following:
-
Create an empty "bm-strategy-package-fs-root.jar" in the folder with your classes (For Eclipse, it's
<your workspace>\\Strategies\\bin
). -
Select it in the Bookmap strategy loading dialogue and configure Bookmap to load the strategy (e.g., pick the last entry point, make sure Auto enable and auto load is on, and the strategy is enabled in Bookmap). Now you can remove the file.
-
Configure your IDE to run Bookmap. For this, configure the IDE to:
- Add C:\Program Files (x86)\Bookmap\Bookmap.exe to classpath - start velox.ib.Main
- Add -Xmx1000M to VM options
- Use C:\Bookmap\Config as the working directory
Now you should be able to use this configuration to start Bookmap with the latest version of your strategy.
Note: the JRE used to start Bookmap should be a 32-bit one (you can use a bundled one from C:\Program Files (x86)\Bookmap\jre), and Bookmap.exe should be added as a user entry (in the Eclipse run configuration):
Insert screenshot
When Bookmap is started this way the strategy can be debugged from the IDE. Here is a screenshot of what you should be able to do (in this example, the Strategies project is set to source lookup when Eclipse asked for it.
To repeat it, place a breakpoint into the same place and with "Large orders filter" strategy loaded, as explained above, and send an order of size 11 or larger - it will be "rejected" by strategy, and if you are in debug mode, you will be able to control it step-by-step):
Insert screenshot
When running Bookmap this way, most features of the IDE can be used, including the one allowing editing the code in debug mode without restarting the application.
The next step in the process would be to test the provided sample strategies and start creating your own.
API Documentation
Bookmap is a Java program in its core with GPU accelerated rendering based on C++ OpenGL. Custom modules must be developed in Java and shipped as JAR files, but on their other end they may connect to an API with any programming language, hence the name adapters. The complete API documentation is part of Bookmap installer. Its name is bm-l1api-javadoc.jar located in C:\Program Files\Bookmap\lib (given default installation paths).
Note: it's not recommended to extract it in the installation folder. The API supports versioning, allowing back-compatibility.
More details and source code examples can be found on Bookmap's GitHub page. Setup examples are demonstrated using Eclipse IDE, but there is no requirements for a specific development framework.