Developing with Bookmap API (step-by-step)

Custom indicators, trading strategies, data export and recording and more...
Serg
Posts: 106
Joined: Mon Jun 11, 2018 12:40 pm
Has thanked: 17 times
Been thanked: 28 times

Developing with Bookmap API (step-by-step)

Post by Serg » Tue Oct 30, 2018 5:21 pm

A recommended background for this post is: Summary
This post provides a step-by-step instructions for how to import an example collection of custom modules into your Java development environment and how to export a Jar file that can be imported into Bookmap.


Step 1: Download the project

Download the Github project as a zip file and extract it:

01.png
01.png (76.42 KiB) Viewed 3094 times
02.png
02.png (17.35 KiB) Viewed 3094 times
Step 2: Prepare your Java development environment (IDE)
This is a Gradle project and can be imported into any Gradle supporting Java IDE. Here we use Eclipse Photon for demonstration. Make sure you have Java Development Kit (JDK) 8 installed. Launch Eclipse and create a workspace (not in the same folder where the project is):

03.png
03.png (17.68 KiB) Viewed 3094 times
Once Eclipse opened, close the "Welcome" tab

04.png
04.png (111.35 KiB) Viewed 3094 times
Step 3: Gradle

Make sure you have Gradle integrated into Eclipse. Go to Help->Eclipse marketplace..., search for "Buildship" and install if it wasn't installed already:

05.png
05.png (89.91 KiB) Viewed 3094 times
Step 4: Import the project

Click on empty space under Project Explorer and select Import:

06.png
06.png (76.22 KiB) Viewed 3094 times
Select Existing Gradle project, click Next and select the unzipped project folder, and click Finish:

07.png
07.png (74.71 KiB) Viewed 3094 times
08.png
08.png (76.01 KiB) Viewed 3094 times
Few seconds later you should see the project successfully loaded with all dependencies:

09.png
09.png (72.87 KiB) Viewed 3094 times
Step 5: Export the project as a Jar file

Before you start developing your own custom modules, let's export the existing project as a jar file and make sure it works with Bookmap. Right-click on the project, click Export, choose Jar file, and click Next:

10.png
10.png (90.19 KiB) Viewed 3094 times
In the next window you can uncheck the project and then select only "src/main/java" as shown below. Also, set a path and name for your Jar file and click Finish:

11.png
11.png (96.98 KiB) Viewed 3094 times
Congratulations! You have created a jar file with Bookmap API custom modules. Now import it into Bookmap and if everything works well, start developing your own custom modules.

Isolating your code from the demo project
At some point you'd probably wish to isolate your development from the demo project. Here are 2 simplest ways to do it while keeping the necessary API dependencies:
  • Create folders / packages of your own development somewhere inside the demo project (should be somewhere under \src\main\java\...) and then export into a jar just the package that you wish to export instead of the whole project.
  • Create a copy the entire demo project and then delete from it everything that you don't need. Note that eclipse still expects the top structure of the source code to be \src\main\java\, but what's inside it is up to you. If you wish to follow the java naming convention, create the structure to be like this: \src\main\java\com\bookmap\api\<your name>\<your indicator>\...

Tags:

Serg
Posts: 106
Joined: Mon Jun 11, 2018 12:40 pm
Has thanked: 17 times
Been thanked: 28 times

Re: Developing with Bookmap API (step-by-step)

Post by Serg » Tue Dec 11, 2018 11:32 am

Main post updated with a link to API documentation (javadoc)

Sire
Posts: 3
Joined: Fri Feb 01, 2019 12:04 am

Re: Developing with Bookmap API (step-by-step)

Post by Sire » Fri Feb 01, 2019 10:34 am

Hi Serg,

Following the procedure with eclipse (IDE 2018) and Javasdk (including JRE) to import the simple demo master folder, several errors appears.

It seem dependencies are not appearing.

Any idea to solve this.

by advance,
Attachments
Eclipse import - pb.png
Eclipse import - pb.png (361.56 KiB) Viewed 2515 times

AndreyR
Posts: 131
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 9 times
Been thanked: 37 times

Re: Developing with Bookmap API (step-by-step)

Post by AndreyR » Tue Oct 15, 2019 1:41 pm

Hi Sire,
is it still an issue?

Post Reply