info.bitrich.xchangestream.btcmarkets.BTCMarketsStreamingExchange Maven / Gradle / Ivy
package info.bitrich.xchangestream.btcmarkets;
import info.bitrich.xchangestream.core.ProductSubscription;
import info.bitrich.xchangestream.core.StreamingExchange;
import info.bitrich.xchangestream.core.StreamingMarketDataService;
import info.bitrich.xchangestream.service.netty.ConnectionStateModel.State;
import io.reactivex.rxjava3.core.Completable;
import io.reactivex.rxjava3.core.Observable;
import org.knowm.xchange.ExchangeSpecification;
import org.knowm.xchange.btcmarkets.BTCMarketsExchange;
public class BTCMarketsStreamingExchange extends BTCMarketsExchange implements StreamingExchange {
private static final String API_URI = "wss://socket.btcmarkets.net/v2";
private BTCMarketsStreamingService streamingService;
private BTCMarketsStreamingMarketDataService streamingMarketDataService;
@Override
protected void initServices() {
super.initServices();
this.streamingService = createStreamingService();
this.streamingMarketDataService = new BTCMarketsStreamingMarketDataService(streamingService);
}
private BTCMarketsStreamingService createStreamingService() {
BTCMarketsStreamingService streamingService = new BTCMarketsStreamingService(API_URI);
applyStreamingSpecification(getExchangeSpecification(), streamingService);
return streamingService;
}
@Override
public Completable connect(ProductSubscription... args) {
return streamingService.connect();
}
@Override
public Completable disconnect() {
return streamingService.disconnect();
}
@Override
public boolean isAlive() {
return streamingService.isSocketOpen();
}
@Override
public Observable reconnectFailure() {
return streamingService.subscribeReconnectFailure();
}
@Override
public Observable
© 2015 - 2024 Weber Informatics LLC | Privacy Policy