use of info.bitrich.xchangestream.binance.BinanceStreamingExchange.USE_REALTIME_BOOK_TICKER in project XChange by knowm.
the class BinanceBookTickerRealtimeExample method main.
public static void main(String[] args) throws InterruptedException {
final ExchangeSpecification exchangeSpecification = new ExchangeSpecification(BinanceStreamingExchange.class);
exchangeSpecification.setShouldLoadRemoteMetaData(true);
exchangeSpecification.setExchangeSpecificParametersItem(USE_REALTIME_BOOK_TICKER, true);
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
ProductSubscription subscription = exchange.getExchangeSymbols().stream().limit(50).reduce(ProductSubscription.create(), ProductSubscription.ProductSubscriptionBuilder::addTicker, (productSubscriptionBuilder, productSubscriptionBuilder2) -> {
throw new UnsupportedOperationException();
}).build();
exchange.connect(subscription).blockingAwait();
exchange.getStreamingMarketDataService().getTicker(CurrencyPair.LTC_BTC).forEach(System.out::println);
Thread.sleep(Long.MAX_VALUE);
}
Aggregations