Skip to content

Commit

Permalink
Merge pull request binance-exchange#290 from eugenpodaru/master
Browse files Browse the repository at this point in the history
Add ws subscriptions for all book tickers stream and ticker stream
  • Loading branch information
joaopsilva authored Nov 16, 2020
2 parents 81a9be7 + 22dc5e5 commit 60eebc2
Show file tree
Hide file tree
Showing 5 changed files with 343 additions and 312 deletions.
39 changes: 28 additions & 11 deletions src/main/java/com/binance/api/client/BinanceApiWebSocketClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ public interface BinanceApiWebSocketClient extends Closeable {
/**
* Open a new web socket to receive {@link DepthEvent depthEvents} on a callback.
*
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onDepthEvent(String symbols, BinanceApiCallback<DepthEvent> callback);

/**
* Open a new web socket to receive {@link CandlestickEvent candlestickEvents} on a callback.
*
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param interval the interval of the candles tick events required
* @param callback the callback to call on new events
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param interval the interval of the candles tick events required
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onCandlestickEvent(String symbols, CandlestickInterval interval, BinanceApiCallback<CandlestickEvent> callback);

/**
* Open a new web socket to receive {@link AggTradeEvent aggTradeEvents} on a callback.
*
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onAggTradeEvent(String symbols, BinanceApiCallback<AggTradeEvent> callback);
Expand All @@ -49,22 +49,39 @@ public interface BinanceApiWebSocketClient extends Closeable {
Closeable onUserDataUpdateEvent(String listenKey, BinanceApiCallback<UserDataUpdateEvent> callback);

/**
* Open a new web socket to receive {@link AllMarketTickersEvent allMarketTickersEvents} on a callback.
* Open a new web socket to receive {@link TickerEvent tickerEvents} on a callback.
*
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onTickerEvent(String symbols, BinanceApiCallback<TickerEvent> callback);

/**
* Open a new web socket to receive {@link List<TickerEvent> allMarketTickersEvents} on a callback.
*
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onAllMarketTickersEvent(BinanceApiCallback<List<AllMarketTickersEvent>> callback);
Closeable onAllMarketTickersEvent(BinanceApiCallback<List<TickerEvent>> callback);

/**
* Open a new web socket to receive {@link BookTickerEvent bookTickerEvents} on a callback.
*
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onBookTickerEvent(String symbols, BinanceApiCallback<BookTickerEvent> callback);

/**
* Open a new web socket to receive {@link TickerEvent allBookTickersEvents} on a callback.
*
* @param callback the callback to call on new events
* @return a {@link Closeable} that allows the underlying web socket to be closed.
*/
Closeable onAllBookTickersEvent(BinanceApiCallback<BookTickerEvent> callback);

/**
* @deprecated This method is no longer functional. Please use the returned {@link Closeable} from any of the other methods to close the web socket.
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.binance.api.client.domain.event;

import org.apache.commons.lang3.builder.ToStringBuilder;

import com.binance.api.client.constant.BinanceApiConstants;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
* BookTickerEvent event for a symbol. Pushes any update to the best bid or
Expand Down
Loading

0 comments on commit 60eebc2

Please sign in to comment.