Page 1 of 1

problems to start with api

Posted: Sat Oct 27, 2018 4:14 pm
by mdtrader

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:
and this one:
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?


Re: problems to start with api

Posted: Sat Oct 27, 2018 5:44 pm
by Svyatoslav
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.

Re: problems to start with api

Posted: Sun Oct 28, 2018 10:05 am
by mdtrader
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 "" for "IndicatorDefinitionUserMessage"
How can I solve this?

Re: problems to start with api

Posted: Mon Oct 29, 2018 8:13 am
by Svyatoslav
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.

Re: problems to start with api

Posted: Tue Oct 30, 2018 3:10 pm
by mdtrader
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

Re: problems to start with api

Posted: Tue Oct 30, 2018 4:37 pm
by Svyatoslav
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.