how to use getOrderBook with Binance?
Closed this issue · 2 comments
willll commented
Hi,
I am trying to retrieve orderbooks from binance, but it keeps returning a nullPointerException :
ProductSubscriptionBuilder subscriptionBuilder = ProductSubscription.create();
ProductSubscription subscription = subscriptionBuilder.build();
streamingExchange.getStreamingMarketDataService()
.getOrderBook(CurrencyPair.LTC_BTC)
.subscribe(orderBook -> {
logger.info(
"Order Book ({}): askDepth={} ask={} askSize={} bidDepth={}. bid={}, bidSize={}"
);
}, throwable -> logger.error("ERROR in getting order book: ", throwable));
I also tried :
streamingExchange.getStreamingMarketDataService().getOrderBook(c).subscribe(orderBook -> {
logger.info("OB :" + c.toString() + " " + (orderBook.toString()));
}, throwable -> {
// Bleh bleh
});
What is the right way ?
badgerwithagun commented
badgerwithagun commented
Closing. Feel free to re-open if you have more questions.