Skip to content

Commit 60eebc2

Browse files
authored
Merge pull request binance-exchange#290 from eugenpodaru/master
Add ws subscriptions for all book tickers stream and ticker stream
2 parents 81a9be7 + 22dc5e5 commit 60eebc2

File tree

5 files changed

+343
-312
lines changed

5 files changed

+343
-312
lines changed

src/main/java/com/binance/api/client/BinanceApiWebSocketClient.java

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ public interface BinanceApiWebSocketClient extends Closeable {
1414
/**
1515
* Open a new web socket to receive {@link DepthEvent depthEvents} on a callback.
1616
*
17-
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
18-
* @param callback the callback to call on new events
17+
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
18+
* @param callback the callback to call on new events
1919
* @return a {@link Closeable} that allows the underlying web socket to be closed.
2020
*/
2121
Closeable onDepthEvent(String symbols, BinanceApiCallback<DepthEvent> callback);
2222

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

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

5151
/**
52-
* Open a new web socket to receive {@link AllMarketTickersEvent allMarketTickersEvents} on a callback.
52+
* Open a new web socket to receive {@link TickerEvent tickerEvents} on a callback.
53+
*
54+
* @param symbols market (one or coma-separated) symbol(s) to subscribe to
55+
* @param callback the callback to call on new events
56+
* @return a {@link Closeable} that allows the underlying web socket to be closed.
57+
*/
58+
Closeable onTickerEvent(String symbols, BinanceApiCallback<TickerEvent> callback);
59+
60+
/**
61+
* Open a new web socket to receive {@link List<TickerEvent> allMarketTickersEvents} on a callback.
5362
*
5463
* @param callback the callback to call on new events
5564
* @return a {@link Closeable} that allows the underlying web socket to be closed.
5665
*/
57-
Closeable onAllMarketTickersEvent(BinanceApiCallback<List<AllMarketTickersEvent>> callback);
66+
Closeable onAllMarketTickersEvent(BinanceApiCallback<List<TickerEvent>> callback);
5867

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

77+
/**
78+
* Open a new web socket to receive {@link TickerEvent allBookTickersEvents} on a callback.
79+
*
80+
* @param callback the callback to call on new events
81+
* @return a {@link Closeable} that allows the underlying web socket to be closed.
82+
*/
83+
Closeable onAllBookTickersEvent(BinanceApiCallback<BookTickerEvent> callback);
84+
6885
/**
6986
* @deprecated This method is no longer functional. Please use the returned {@link Closeable} from any of the other methods to close the web socket.
7087
*/

src/main/java/com/binance/api/client/domain/event/AllMarketTickersEvent.java

Lines changed: 0 additions & 294 deletions
This file was deleted.

src/main/java/com/binance/api/client/domain/event/BookTickerEvent.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package com.binance.api.client.domain.event;
22

3-
import org.apache.commons.lang3.builder.ToStringBuilder;
4-
53
import com.binance.api.client.constant.BinanceApiConstants;
64
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
75
import com.fasterxml.jackson.annotation.JsonProperty;
6+
import org.apache.commons.lang3.builder.ToStringBuilder;
87

98
/**
109
* BookTickerEvent event for a symbol. Pushes any update to the best bid or

0 commit comments

Comments
 (0)