Class BinanceStreamingExchange
java.lang.Object
org.knowm.xchange.BaseExchange
org.knowm.xchange.binance.BinanceExchange
info.bitrich.xchangestream.binance.BinanceStreamingExchange
- All Implemented Interfaces:
StreamingExchange
,Exchange
- Direct Known Subclasses:
BinanceFutureStreamingExchange
,BinanceUsStreamingExchange
-
Field Summary
Fields inherited from class org.knowm.xchange.binance.BinanceExchange
EXCHANGE_TYPE, FUTURES_URL, INVERSE_FUTURES_URL, PORTFOLIO_MARGIN_URL, RESILIENCE_REGISTRIES, SANDBOX_FUTURES_URL, SANDBOX_INVERSE_FUTURES_URL, SANDBOX_SPOT_URL, timestampFactory
Fields inherited from class org.knowm.xchange.BaseExchange
accountService, exchangeMetaData, exchangeSpecification, logger, marketDataService, tradeService
Fields inherited from interface org.knowm.xchange.Exchange
USE_SANDBOX
Fields inherited from interface info.bitrich.xchangestream.core.StreamingExchange
ACCEPT_ALL_CERITICATES, AUTO_RECONNECT, ENABLE_LOGGING_HANDLER, L3_ORDERBOOK, SOCKS_PROXY_HOST, SOCKS_PROXY_PORT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildSubscriptionStreams
(ProductSubscription subscription) io.reactivex.rxjava3.core.Completable
connect
(KlineSubscription klineSubscription, ProductSubscription... args) io.reactivex.rxjava3.core.Completable
connect
(ProductSubscription... args) Binance streaming API expects connections to multiple channels to be defined at connection time.io.reactivex.rxjava3.core.Observable<ConnectionStateModel.State>
Observable for connectionState.io.reactivex.rxjava3.core.Observable<Object>
Observable for connection success event.protected BinanceStreamingService
createStreamingService
(ProductSubscription subscription, KlineSubscription klineSubscription) void
io.reactivex.rxjava3.core.Completable
Disconnect from the WebSocket API.void
Returns service that can be used to access streaming account data.protected String
Returns service that can be used to access streaming market data.Returns service that can be used to access streaming trade data.protected void
boolean
isAlive()
Checks whether connection to the exchange is alive.io.reactivex.rxjava3.core.Observable<Throwable>
Observable for reconnection failure event.void
setChannelInactiveHandler
(WebSocketClientHandler.WebSocketMessageHandler channelInactiveHandler) Enables the user to listen on channel inactive events and react appropriately.void
useCompressedMessages
(boolean compressedMessages) Set whether or not to enable compression handler.Methods inherited from class org.knowm.xchange.binance.BinanceExchange
applySpecification, getDefaultExchangeSpecification, getNonceFactory, getResilienceRegistries, getTimestampFactory, isAuthenticated, isFuturesEnabled, isPortfolioMarginEnabled, remoteInit, resetResilienceRegistries, usingSandbox
Methods inherited from class org.knowm.xchange.BaseExchange
getAccountService, getExchangeInstruments, getExchangeMetaData, getExchangeSpecification, getMarketDataService, getMetaDataFileName, getTradeService, loadExchangeMetaData, loadMetaData, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.knowm.xchange.Exchange
applySpecification, getAccountService, getDefaultExchangeSpecification, getExchangeInstruments, getExchangeMetaData, getExchangeSpecification, getMarketDataService, getNonceFactory, getResilienceRegistries, getTradeService, remoteInit
Methods inherited from interface info.bitrich.xchangestream.core.StreamingExchange
applyStreamingSpecification, connectionIdle, disconnectObservable, messageDelay, resubscribeChannels
-
Field Details
-
USE_HIGHER_UPDATE_FREQUENCY
- See Also:
-
USE_REALTIME_BOOK_TICKER
- See Also:
-
FETCH_ORDER_BOOK_LIMIT
- See Also:
-
-
Constructor Details
-
BinanceStreamingExchange
public BinanceStreamingExchange()
-
-
Method Details
-
initServices
protected void initServices()- Overrides:
initServices
in classBinanceExchange
-
connect
public io.reactivex.rxjava3.core.Completable connect(KlineSubscription klineSubscription, ProductSubscription... args) -
connect
Binance streaming API expects connections to multiple channels to be defined at connection time. To define the channels for this connection pass a `ProductSubscription` in at connection time.- Specified by:
connect
in interfaceStreamingExchange
- Parameters:
args
- A single `ProductSubscription` to define the subscriptions required to be available during this connection.- Returns:
- A completable which fulfils once connection is complete.
-
disconnect
public io.reactivex.rxjava3.core.Completable disconnect()Description copied from interface:StreamingExchange
Disconnect from the WebSocket API.- Specified by:
disconnect
in interfaceStreamingExchange
- Returns:
Completable
that completes upon successful disconnect.
-
isAlive
public boolean isAlive()Description copied from interface:StreamingExchange
Checks whether connection to the exchange is alive.- Specified by:
isAlive
in interfaceStreamingExchange
- Returns:
- true if connection is open, otherwise false.
-
reconnectFailure
Description copied from interface:StreamingExchange
Observable for reconnection failure event. When this happens, it usually indicates that the server or the network is down.- Specified by:
reconnectFailure
in interfaceStreamingExchange
- Returns:
- Observable with the exception during reconnection.
-
connectionSuccess
Description copied from interface:StreamingExchange
Observable for connection success event. When this happens, it usually indicates that the server or the network is down.- Specified by:
connectionSuccess
in interfaceStreamingExchange
- Returns:
- Observable
-
connectionStateObservable
Description copied from interface:StreamingExchange
Observable for connectionState. designed to replaces connectionSuccess reconnectFailure disconnectObservable- Specified by:
connectionStateObservable
in interfaceStreamingExchange
- Returns:
- Observable
-
getStreamingMarketDataService
Description copied from interface:StreamingExchange
Returns service that can be used to access streaming market data.- Specified by:
getStreamingMarketDataService
in interfaceStreamingExchange
-
getStreamingAccountService
Description copied from interface:StreamingExchange
Returns service that can be used to access streaming account data.- Specified by:
getStreamingAccountService
in interfaceStreamingExchange
-
getStreamingTradeService
Description copied from interface:StreamingExchange
Returns service that can be used to access streaming trade data.- Specified by:
getStreamingTradeService
in interfaceStreamingExchange
-
createStreamingService
protected BinanceStreamingService createStreamingService(ProductSubscription subscription, KlineSubscription klineSubscription) -
getStreamingBaseUri
-
buildSubscriptionStreams
-
useCompressedMessages
public void useCompressedMessages(boolean compressedMessages) Description copied from interface:StreamingExchange
Set whether or not to enable compression handler.- Specified by:
useCompressedMessages
in interfaceStreamingExchange
- Parameters:
compressedMessages
- Defaults to false
-
enableLiveSubscription
public void enableLiveSubscription() -
disableLiveSubscription
public void disableLiveSubscription() -
setChannelInactiveHandler
public void setChannelInactiveHandler(WebSocketClientHandler.WebSocketMessageHandler channelInactiveHandler) Enables the user to listen on channel inactive events and react appropriately.- Parameters:
channelInactiveHandler
- a WebSocketMessageHandler instance.
-