Class KrakenStreamingExchange
java.lang.Object
org.knowm.xchange.BaseExchange
org.knowm.xchange.kraken.KrakenExchange
info.bitrich.xchangestream.kraken.KrakenStreamingExchange
- All Implemented Interfaces:
StreamingExchange
,Exchange
- Author:
- makarid
-
Field Summary
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 TypeMethodDescriptionauthData
(KrakenAccountServiceRaw accountServiceRaw) Gets a WebSocketToken following https://support.kraken.com/hc/en-us/articles/360034664311-How-to-subscribe-to-the-Kraken-WebSocket-private-feedsio.reactivex.rxjava3.core.Completable
connect
(ProductSubscription... args) Connects to the WebSocket API of the exchange.io.reactivex.rxjava3.core.Observable<ConnectionStateModel.State>
Observable for connectionState.io.reactivex.rxjava3.core.Observable<Object>
Observable for connection success event.io.reactivex.rxjava3.core.Completable
Disconnect from the WebSocket API.io.reactivex.rxjava3.core.Observable<Object>
Observable for disconnection event.io.reactivex.rxjava3.core.Observable<KrakenSubscriptionStatusMessage>
io.reactivex.rxjava3.core.Observable<KrakenSubscriptionStatusMessage>
Returns service that can be used to access streaming market data.Returns service that can be used to access streaming trade data.io.reactivex.rxjava3.core.Observable<KrakenSystemStatus>
protected void
boolean
isAlive()
Checks whether connection to the exchange is alive.static String
pickUri
(boolean isPrivate, boolean useBeta) io.reactivex.rxjava3.core.Observable<ConnectionStateModel.State>
io.reactivex.rxjava3.core.Observable<Object>
io.reactivex.rxjava3.core.Observable<Object>
io.reactivex.rxjava3.core.Observable<Throwable>
io.reactivex.rxjava3.core.Observable<Throwable>
Observable for reconnection failure event.void
void
useCompressedMessages
(boolean compressedMessages) Set whether or not to enable compression handler.Methods inherited from class org.knowm.xchange.kraken.KrakenExchange
remoteInit
Methods inherited from class org.knowm.xchange.BaseExchange
applySpecification, getAccountService, getExchangeInstruments, getExchangeMetaData, getExchangeSpecification, getMarketDataService, getMetaDataFileName, getNonceFactory, 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, getExchangeInstruments, getExchangeMetaData, getExchangeSpecification, getMarketDataService, getNonceFactory, getResilienceRegistries, getTradeService, remoteInit
Methods inherited from interface info.bitrich.xchangestream.core.StreamingExchange
applyStreamingSpecification, connectionIdle, getStreamingAccountService, messageDelay
-
Constructor Details
-
KrakenStreamingExchange
public KrakenStreamingExchange()
-
-
Method Details
-
pickUri
-
initServices
protected void initServices()- Overrides:
initServices
in classKrakenExchange
-
connect
Description copied from interface:StreamingExchange
Connects to the WebSocket API of the exchange.- Specified by:
connect
in interfaceStreamingExchange
- Parameters:
args
- Product subscription is used only in certain exchanges where you need to specify subscriptions during the connect phase.- Returns:
Completable
that completes upon successful connection.
-
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.
-
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
-
disconnectObservable
Description copied from interface:StreamingExchange
Observable for disconnection event.- Specified by:
disconnectObservable
in interfaceStreamingExchange
- Returns:
- Observable
-
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.
-
connectionStateObservable
Description copied from interface:StreamingExchange
Observable for connectionState. designed to replaces connectionSuccess reconnectFailure disconnectObservable- Specified by:
connectionStateObservable
in interfaceStreamingExchange
- Returns:
- Observable
-
privateConnectionSuccess
-
privateReconnectFailure
-
privateConnectionStateObservable
public io.reactivex.rxjava3.core.Observable<ConnectionStateModel.State> privateConnectionStateObservable() -
privateDisconnectObservable
-
getDefaultExchangeSpecification
- Specified by:
getDefaultExchangeSpecification
in interfaceExchange
- Overrides:
getDefaultExchangeSpecification
in classKrakenExchange
- Returns:
- A default ExchangeSpecification to use during the creation process if one is not supplied
-
getStreamingMarketDataService
Description copied from interface:StreamingExchange
Returns service that can be used to access streaming market data.- Specified by:
getStreamingMarketDataService
in interfaceStreamingExchange
-
getStreamingTradeService
Description copied from interface:StreamingExchange
Returns service that can be used to access streaming trade data.- Specified by:
getStreamingTradeService
in interfaceStreamingExchange
-
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
-
authData
Gets a WebSocketToken following https://support.kraken.com/hc/en-us/articles/360034664311-How-to-subscribe-to-the-Kraken-WebSocket-private-feedsToken requests should be made before any Websocket reconnection to avoid cases where the token has become invalid due to issues on the Kraken side.
From Kraken support:
In theory WebSocket authentication tokens can last indefinitely, but in reality they do sometimes expire causing an invalid session error. As an example, during a recent WebSocket API upgrade, many authentication tokens became invalid (for no apparent reason to the token owners), causing unexpected invalid session errors upon reconnecting/resubscribing after the upgrade.
- Parameters:
accountServiceRaw
- account service to query new token against- Returns:
- token retrieved
-
resubscribeChannels
public void resubscribeChannels()- Specified by:
resubscribeChannels
in interfaceStreamingExchange
-
getSystemStatusChanges
-
getPublicSubscriptionStatusChanges
public io.reactivex.rxjava3.core.Observable<KrakenSubscriptionStatusMessage> getPublicSubscriptionStatusChanges() -
getPrivateSubscriptionStatusChanges
public io.reactivex.rxjava3.core.Observable<KrakenSubscriptionStatusMessage> getPrivateSubscriptionStatusChanges()
-