problems to start with api

Market data, Trading, Technical support, Features requests, etc
mdtrader
Posts: 39
Joined: Sat Oct 27, 2018 4:05 pm
Location: germany
Has thanked: 13 times
Been thanked: 36 times

problems to start with api

Post by mdtrader » Sat Oct 27, 2018 4:14 pm

Hi,

I usually code in C++ and I need some help to start coding for Bookmap.
I installed Eclipse and copied the jre directory from bookmap into the eclipse directory, hoping it's all I need to create my own jar files but I end up with this error:
java.lang.UnsupportedClassVersionError: velox/api/layer1/layers/tradinghelper/Layer1ApiHelperChaseStrategy has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
Wich JRE is needed?

I modified the environment along this document:
https://github.com/BookmapAPI/Layer0ApiDemo
and this one:
https://github.com/BookmapAPI/DemoStrategies
But it seemes that something is wrong. Can someone provide me with a working example or configuration to start with programming for Bookmap 7 with Eclipse please?

Thanks

Svyatoslav
Site Admin
Posts: 29
Joined: Mon Jun 11, 2018 11:44 am
Been thanked: 3 times

Re: problems to start with api

Post by Svyatoslav » Sat Oct 27, 2018 5:44 pm

Hi,
This error usually appears when Java does not recognize the version. If I'm not mistaken, version 54 is Java 10, and bookmap currently uses Java 8. Try building your code with Java 8 instead of 10.
Wich JRE is needed?
Both JDK and JRE should be Java 8. Bookmap comes with bundled JRE (which you can use to start bookmap from IDE if you want to), but you'll have to install JDK 8 manually in order to compile the code in format that bookmap (or rather bundled JRE) can understand.

mdtrader
Posts: 39
Joined: Sat Oct 27, 2018 4:05 pm
Location: germany
Has thanked: 13 times
Been thanked: 36 times

Re: problems to start with api

Post by mdtrader » Sun Oct 28, 2018 10:05 am

I used version Java SE 1.8.0_191 but it seemed that Bookmap use 0_121...
I started brand new, created a new project and added the src-directory along the "Layer0APIDemo" documentation but now I got errors for deprecated function calls in "DemoGeneratorReplayProvider.java" for "IndicatorDefinitionUserMessage"
How can I solve this?

Svyatoslav
Site Admin
Posts: 29
Joined: Mon Jun 11, 2018 11:44 am
Been thanked: 3 times

Re: problems to start with api

Post by Svyatoslav » Mon Oct 29, 2018 8:13 am

Are those errors or warnings? Deprecation is typically a warning, meaning you still can compile and run. It just means that this method ideally should not be used.
Regarding why those are in the demo project... we deprecated IndicatorPointUserMessage and OrderQueuePositionUserMessage because it's the part of API that might get removed later at some point, but first we need to implement a proper replacement (which we currently don't have in place).
You can also add @SuppressWarnings("deprecation") to the entire class in order not to see the warning.

mdtrader
Posts: 39
Joined: Sat Oct 27, 2018 4:05 pm
Location: germany
Has thanked: 13 times
Been thanked: 36 times

Re: problems to start with api

Post by mdtrader » Tue Oct 30, 2018 3:10 pm

I'm a little confused now, the error in the sample file shows that this function has not the correct number of fields.
This is in the sample file "DemoGeneratorReplayProvider" line 163:
IndicatorDefinitionUserMessage indicatorDefinitionMessage = new IndicatorDefinitionUserMessage(
1, "Test instrument 2",
(short)0xFFFF, (short)1, 1, Color.ORANGE,
(short)0xFF08, (short)1, 2, Color.GREEN,
icon, -icon.getWidth() / 2, -icon.getHeight() / 2);
and this shows the javadoc:
IndicatorDefinitionUserMessage(int id, java.lang.String alias, short mainLineStyleMask, short mainLineStyleMultiplier, int mainLineWidth, java.awt.Color lineColor, short rightLineStyleMask, short rightLineStyleMultiplier, int rightLineWidth, java.awt.image.BufferedImage icon, int iconOffsetX, int iconOffsetY, boolean showOnMainChart)

The parameter Color.Green on second position is wrong, I deleted it.

I've no idea how to bring this example to life because I've no experience working with eclipse and java (only Visual Studio and C++), is it possible that you show me step by step how to run it?
The steps I've done so far:
1. no errors in the source files now
2. added "velox.api.layer0.replay.DemoTextDataReplayProvider E:\Layer0ApiDemo\bin" into the file
"C:\Program Files\BookMap\lib\UserModules\L0\external-reader-modules.txt"
3. added all jar files from "C:\Program Files\BookMap\lib" into project/properties/libraries

What are the next steps to compile this into "E:\Layer0ApiDemo\bin"? And how (right mouse on project and export/jar)?
The documentation speaks about running Bookmap from Eclipse but I've no idea how to do this

Would be great if you could help
Thanks

Svyatoslav
Site Admin
Posts: 29
Joined: Mon Jun 11, 2018 11:44 am
Been thanked: 3 times

Re: problems to start with api

Post by Svyatoslav » Tue Oct 30, 2018 4:37 pm

First of all - sorry for the inconvenience caused, I think cleaning up the documentation and L0 demo is a bit overdue... We'll try to handle that shortly (some of that is being handled right now).

That parameter actually was removed in Bookmap 7.0.0 b48, but for some reason change did not get to public repository. I just fixed that - you can update to the latest revision. Alternatively you can just remove that Color.GREEN (which you already did) and add "true" as a last parameter (probably you did that too).

Regarding the steps:
1. Make sure eclipse is compiling to E:\Layer0ApiDemo\bin. It most likely is doing that already if you have project as E:\Layer0ApiDemo. If you see a folder "velox" in E:\Layer0ApiDemo\bin - most likely it's ok.
2. Make sure you have your license configured for L0 development (you can't check it directly yet). If you did not contact support yet - please contact them and ask to enable it (or send me your login on the main site or first 9 characters of your license key and I'll enable it for you). If you contacted them - probably you are good.
3. Start Bookmap normally. You don't have to run it from Eclipse, it is more convenient for debugging, but you don't have to. It should load the reader module automatically.
4. Try opening any feed file. The module you just compiled will take control and start sending generated data instead of real data (see DemoTextDataReplayProvider for a more discrete loading logic).
5. If it does not work - send me your log file (and login or few first license key letters) - I'll check what might be wrong.

Post Reply