use of info.bitrich.xchangestream.core.StreamingExchange in project XChange by knowm.
the class CoinjarUserTradesExample method runTest.
@Test
public void runTest() {
ExchangeSpecification defaultExchangeSpecification = new ExchangeSpecification(CoinjarStreamingExchange.class);
AuthUtils.setApiAndSecretKey(defaultExchangeSpecification);
if (defaultExchangeSpecification.getApiKey() != null) {
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(defaultExchangeSpecification);
exchange.connect().blockingAwait();
StreamingTradeService streamingTradeService = exchange.getStreamingTradeService();
Disposable disposable = streamingTradeService.getUserTrades(null).test().awaitCount(1, BaseTestConsumer.TestWaitStrategy.SLEEP_100MS, 1000 * 60 * 10).assertNoErrors();
disposable.dispose();
}
}
use of info.bitrich.xchangestream.core.StreamingExchange in project XChange by knowm.
the class FtxStreamingMarketDataServiceIntegration method orderbookCorrectnessTest.
@Test
@Ignore
public void orderbookCorrectnessTest() throws Exception {
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(FtxStreamingExchange.class);
exchange.connect(ProductSubscription.create().addAll(new CurrencyPair("BTC-PERP")).build()).blockingAwait();
Disposable dis = exchange.getStreamingMarketDataService().getOrderBook(new CurrencyPair("BTC-PERP")).retry().subscribe(orderBook -> {
if (orderBook.getBids().size() > 0 && orderBook.getAsks().size() > 0) {
LOG.info("Ask 3: " + orderBook.getAsks().get(2).getLimitPrice() + " volume " + orderBook.getAsks().get(2).getOriginalAmount());
LOG.info("Ask 2: " + orderBook.getAsks().get(1).getLimitPrice() + " volume " + orderBook.getAsks().get(1).getOriginalAmount());
LOG.info("Ask 1: " + orderBook.getAsks().get(0).getLimitPrice() + " volume " + orderBook.getAsks().get(0).getOriginalAmount());
LOG.info("--");
LOG.info("Bid 1: " + orderBook.getBids().get(0).getLimitPrice() + " volume " + orderBook.getBids().get(0).getOriginalAmount());
LOG.info("Bid 2: " + orderBook.getBids().get(1).getLimitPrice() + " volume " + orderBook.getBids().get(1).getOriginalAmount());
LOG.info("Bid 3: " + orderBook.getBids().get(2).getLimitPrice() + " volume " + orderBook.getBids().get(2).getOriginalAmount());
LOG.info("=================");
}
});
while (true) {
TimeUnit.SECONDS.sleep(60);
}
}
use of info.bitrich.xchangestream.core.StreamingExchange in project XChange by knowm.
the class CoinmateManualExample method main.
public static void main(String[] args) {
ExchangeSpecification exSpec = new CoinmateStreamingExchange().getDefaultExchangeSpecification();
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(exSpec);
exchange.connect().blockingAwait();
exchange.getStreamingMarketDataService().getOrderBook(CurrencyPair.BTC_EUR).subscribe(orderBook -> {
LOG.info("Ask: {}", orderBook.getAsks().get(0));
LOG.info("Bid: {}", orderBook.getBids().get(0));
});
exchange.getStreamingMarketDataService().getTrades(CurrencyPair.BTC_USD).subscribe(trade -> {
LOG.info("Trade {}", trade);
});
try {
Thread.sleep(100000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
use of info.bitrich.xchangestream.core.StreamingExchange in project XChange by knowm.
the class CoinjarStreamingMarketDataServiceIntegration method runTestUsdcAud.
@Test
public void runTestUsdcAud() {
ExchangeSpecification defaultExchangeSpecification = new ExchangeSpecification(CoinjarStreamingExchange.class);
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(defaultExchangeSpecification);
exchange.connect().blockingAwait();
StreamingMarketDataService streamingMarketDataService = exchange.getStreamingMarketDataService();
Disposable usdtOrderBookDisposable = streamingMarketDataService.getOrderBook(new CurrencyPair(Currency.USDC, Currency.AUD)).test().awaitCount(10).assertNoErrors();
usdtOrderBookDisposable.dispose();
}
use of info.bitrich.xchangestream.core.StreamingExchange in project XChange by knowm.
the class CoinjarStreamingMarketDataServiceIntegration method runTestBtcAud.
@Test
public void runTestBtcAud() {
ExchangeSpecification defaultExchangeSpecification = new ExchangeSpecification(CoinjarStreamingExchange.class);
StreamingExchange exchange = StreamingExchangeFactory.INSTANCE.createExchange(defaultExchangeSpecification);
exchange.connect().blockingAwait();
StreamingMarketDataService streamingMarketDataService = exchange.getStreamingMarketDataService();
Disposable btcOrderBookDisposable = streamingMarketDataService.getOrderBook(CurrencyPair.BTC_AUD).test().awaitCount(10).assertNoErrors();
btcOrderBookDisposable.dispose();
}
Aggregations