Hi,
when I'am in "drag mode" on the heatmap chart and moving the chart, then I can see the historical data of the orderbook. That's a nice feature.
I've an addon that displays some data in the heartmap based on orderbook data. Is there any bookmap-api support to use this historical data feature for my addon?
Thanks,
bronko
Drag-Mode and historical data
-
- Posts: 554
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 25 times
- Been thanked: 86 times
Re: Drag-Mode and historical data
Hi bronko,
you'll need to modify the addon to receive the historical data. Can you modify your addon? Sorry for any misunderstanding, I need to figure out if the addon you have can be modified or not.
you'll need to modify the addon to receive the historical data. Can you modify your addon? Sorry for any misunderstanding, I need to figure out if the addon you have can be modified or not.
Re: Drag-Mode and historical data
Yes, I can modify my addon.
Are you talking about the interfaces "HistoricalDataListener/HistoricalModeAdapter" when you say "receive the historical data"?
How I can use them?
Thanks,
bronko
Are you talking about the interfaces "HistoricalDataListener/HistoricalModeAdapter" when you say "receive the historical data"?
How I can use them?
Thanks,
bronko
-
- Posts: 554
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 25 times
- Been thanked: 86 times
Re: Drag-Mode and historical data
Hi,
HistoricalDataListener/HistoricalModeAdapter are interfaces for Simplified API which make your addon receive historical data (data starting from the moment Bookmap was loaded to the point the addon was loaded).
HistoricalDataListener/HistoricalModeAdapter are interfaces for Simplified API which make your addon receive historical data (data starting from the moment Bookmap was loaded to the point the addon was loaded).
Code: Select all
(a moment in the past)----BackfilledDataListener--->(Bookmap started)---->HistoricalDataListener--->(Addon started)
Do you mean you need your addon to react to the data shown on the chart while dragging the chart (or reacting to the historical orderbook changing its state while dragging the chart)?when I'am in "drag mode" on the heatmap chart and moving the chart, then I can see the historical data of the orderbook.
...
I've an addon that displays some data in the heartmap based on orderbook data.
Re: Drag-Mode and historical data
Hi,
I mean reacting to the historical orderbook changing its state while dragging the chart.
Thanks.
bronko
I mean reacting to the historical orderbook changing its state while dragging the chart.
Thanks.
bronko
-
- Posts: 554
- Joined: Mon Jul 09, 2018 11:18 am
- Has thanked: 25 times
- Been thanked: 86 times
Re: Drag-Mode and historical data
Hi. You will need to use Core API to request data for historical orderbooks.
We have no good single example that will fit your request so we will need to take a look at more than one module as examples.
https://github.com/BookmapAPI/DemoStrat ... sDemo.java
https://github.com/BookmapAPI/DemoStrat ... dDemo.java
1) acquire the link to the data tree (example Layer1ApiMarkersDemo#onUserMessage)
We can get the link to the data tree (DataStructureInterface dataStructureInterface) in the #onUserMessage method.
2) get the timestamp for the right edge of the chart(example Layer1ApiGridDemo)
The easiest way to get it you need your module implementing ScreenSpacePainterAdapter. See Layer1ApiGridDemo as an example.
You can get the left edge timestamp from #onHeatmapTimeLeft method and the chart time width from #heatmapActiveTimeWidth method. Adding those will get you the right edge value.
3) make request to the data tree(example Layer1ApiMarkersDemo#calculateValuesInRange)
Take a look at the Layer1ApiMarkersDemo and see the #calculateValuesInRange method for an example.
4) construct a historical orderbook(example Layer1ApiMarkersDemo#calculateValuesInRange)
Again, take a look at the Layer1ApiMarkersDemo and see the calculateValuesInRange method for an example.
In your case this line will look like
DepthAggregationEvent contains maps if bids and asks so you can construct your order book and visualize it with you tools.
We have no good single example that will fit your request so we will need to take a look at more than one module as examples.
https://github.com/BookmapAPI/DemoStrat ... sDemo.java
https://github.com/BookmapAPI/DemoStrat ... dDemo.java
1) acquire the link to the data tree (example Layer1ApiMarkersDemo#onUserMessage)
We can get the link to the data tree (DataStructureInterface dataStructureInterface) in the #onUserMessage method.
2) get the timestamp for the right edge of the chart(example Layer1ApiGridDemo)
The easiest way to get it you need your module implementing ScreenSpacePainterAdapter. See Layer1ApiGridDemo as an example.
You can get the left edge timestamp from #onHeatmapTimeLeft method and the chart time width from #heatmapActiveTimeWidth method. Adding those will get you the right edge value.
3) make request to the data tree(example Layer1ApiMarkersDemo#calculateValuesInRange)
Take a look at the Layer1ApiMarkersDemo and see the #calculateValuesInRange method for an example.
Code: Select all
ArrayList<TreeResponseInterval> intervalResponse = dataStructureInterface.get(t0, intervalWidth, intervalsNumber, alias,
new StandardEvents[] {StandardEvents.TRADE});
To get a historical orderbook you need to get aggregated depth events (StandardEvents.DEPTH) to the right adge of the chart. In your case t0 must be the timestamp on the right edge of the chart and both intervalWidth and intervalNumbers can be ignored.javadoc
DataStructureInterface.get(long t0, long intervalWidth, int intervalNumber, String alias, StandardEvents[] interestedEvents)
Query for standard events Returns list, containing aggregation from start time to t0 exclusive, followed by list of aggregations for the interval [t0, t0 + intervalWidth * intervalNumbers), divided by intervalNumber parts
4) construct a historical orderbook(example Layer1ApiMarkersDemo#calculateValuesInRange)
Again, take a look at the Layer1ApiMarkersDemo and see the calculateValuesInRange method for an example.
Code: Select all
double lastPrice = ((TradeAggregationEvent) intervalResponse.get(0).events.get(StandardEvents.TRADE.toString())).lastPrice;
Code: Select all
DepthAggregationEvent depthEvent = (DepthAggregationEvent) intervalResponse.get(0).events.get(StandardEvents.DEPTH.toString());