I've been able to modify some of the samples provided, such as the MBO Visualizer, etc.
What I would like to do is to capture the standing order id's on each side (Bid and Ask) at the beginning of the day, and track them throughout the day as more Depth is added/removed and Trades are occurring. It looked like I should be using the OrderByOrderBook class, but I am unable to get any records from it when I am iterating through the class. Here is the pseudocode workflow of what I would like to do. Do you have any sample code that would help me along?
1) During initialization :
OpenStanding OrderBook.
For each standing order id, store current status (price, size, bid/ask) in an array.
2) During Runtime :
a) Upon receipt of OrderBook call (Send, Replace, Cancel), modify my copy of OrderBook entries.
b) Upon receipt of a Trade occurrence, note trade information order ids, and size, and update my copy of OrderBook entries.
I am using 7.1 version of bookmap.
Use OrderByOrderBook
-
- Posts: 552
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 25 times
- Been thanked: 86 times
Re: Use OrderByOrderBook
hi rickbarlow,
1)
Once you have ids you can extract any single order with getOrder(...) method.
2)
You don't need to update the orderbook from onTrade method.
Pls take a look at the source file attached. I used OrderByOrder book there. Please note it uses numerical ids so I had to keep a map to turn text ids to numerical ids. I used bidimap to be also able to get text ids from numerical ids. If you do so pls add to your build.gradle dependencies section
1)
Can you pls clarify the kind of info you need. OrderByOrderBook has getAllIds() method which returns a collection of current orders ids.It looked like I should be using the OrderByOrderBook class, but I am unable to get any records from it when I am iterating through the class
Once you have ids you can extract any single order with getOrder(...) method.
2)
replace(...) method for MarketByOrderDepthDataListener already contains the changes caused by trades.During Runtime :
b) Upon receipt of a Trade occurrence, note trade information order ids, and size, and update my copy of OrderBook entries.
You don't need to update the orderbook from onTrade method.
Pls take a look at the source file attached. I used OrderByOrder book there. Please note it uses numerical ids so I had to keep a map to turn text ids to numerical ids. I used bidimap to be also able to get text ids from numerical ids. If you do so pls add to your build.gradle dependencies section
Code: Select all
compileOnly 'org.apache.commons:commons-collections4:4.1'
- Attachments
-
- MboOrderByOrderBook.java
- (2.59 KiB) Downloaded 191 times