binance-exchange/binance-java-api

Binance aggTrade for multiple streams is not working

kaushik1979 opened this issue · 0 comments

Hi,

I have an issue with the binance aggTrade api for future data. As per the api doc, when I create a streaming link and open a websocket with it, no data comes back.

streamingUrl -
wss://fstream.binance.com/ws/stream?streams=btcusdt@aggTrade/ethusdt@aggTrade/bnbusdt@aggTrade

However, the link for single future contract works like a charm.

streamingUrl -
wss://fstream.binance.com/ws/btcusdt@aggTrade

API Doc - https://binance-docs.github.io/apidocs/futures/en/#aggregate-trade-streams

Code establishing websocket connection -

import static com.binance.api.client.impl.BinanceApiServiceGenerator.getSharedClient;

client = getSharedClient().newBuilder().pingInterval(3, TimeUnit.MINUTES).build();

...
...

Request request = new Request.Builder().url(streamingUrl).build();
final WebSocket webSocket = client.newWebSocket(request, listener);
return () -> {
    final int code = 1000;
    listener.onClosing(webSocket, code, null);
    webSocket.close(code, null);
    listener.onClosed(webSocket, code, null);
};

Can someone help me resolve this issue please?