Hello all,
I am currently trying to figure out how I can access orderbook data from within the Java API. Here's what I have so far:
If you see in my debugger, I can view the orderbook object if I insert a breakpoint in my overridden onBar function. I can view Bar data with the built in Bar object no problem. For example:
bar.getClose(); if I want to access the last closing price of said bar.
However, anytime I try to access any kind of orderbook information, for instance:orderBook.getBestAskPriceOrNone();I get the following error in my Bookmap.jar instance when I reload my addon:
java.lang.NullPointerException: Cannot invoke "velox.api.layer1.layers.utils.OrderBook.getBestAskPriceOrNone()" because "orderBook" is null
Obviously, as you can see from the screenshot included, that orderBook is not null. I am assuming this is because I am using the free version of Bookmap for development right now and I have not purchased an MBO data package.
I would like to know if this is something I need to do, and if so, is there anyway to access COB data without having an MBO data subscription?
Thank you for your help in advance. Have a good day!
Java Simplified API: Question regarding accessing Orderbook data
-
- Posts: 2
- Joined: Tue Apr 02, 2024 5:30 pm
- Has thanked: 1 time
- Been thanked: 2 times
Java Simplified API: Question regarding accessing Orderbook data
- Attachments
-
- OrderbookQuestion2.png (44.46 KiB) Viewed 4667 times
-
- OrderbookQuestion.png (322.99 KiB) Viewed 4667 times
-
- Posts: 563
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 27 times
- Been thanked: 86 times
Re: Java Simplified API: Question regarding accessing Orderbook data
Thx for your question, we will figure that out. API should work correctly for any Bookmap package.
-
- Posts: 563
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 27 times
- Been thanked: 86 times
Re: Java Simplified API: Question regarding accessing Orderbook data
Order book can be null if depth data starts a bit late which may be at the very beginning of data feed. Please check if it is null before accessing it.
Code: Select all
@Override
public void onBar(OrderBook ob, Bar bar) {
if (ob != null) {
//your code here
-
- Posts: 2
- Joined: Tue Apr 02, 2024 5:30 pm
- Has thanked: 1 time
- Been thanked: 2 times
Re: Java Simplified API: Question regarding accessing Orderbook data
Hi Andry,
Thank you so much that worked perfectly! That probably saved me a whole day or two of going on wild goose chases
Thank you so much that worked perfectly! That probably saved me a whole day or two of going on wild goose chases