use of org.knowm.xchange.ExchangeSpecification 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 org.knowm.xchange.ExchangeSpecification 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 org.knowm.xchange.ExchangeSpecification 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 org.knowm.xchange.ExchangeSpecification 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();
}
use of org.knowm.xchange.ExchangeSpecification in project XChange by knowm.
the class CoinbaseProStreamingExchangeTest method testOverrideWebsocketApiUriWhenUsingPrime.
@Test
public void testOverrideWebsocketApiUriWhenUsingPrime() {
final String overrideWebsocketApiUri = "wss://demo.websocket.com";
final CoinbaseProStreamingExchange coinbaseProStreamingExchange = new CoinbaseProStreamingExchange();
final ExchangeSpecification sandboxExchangeSpecification = coinbaseProStreamingExchange.getDefaultExchangeSpecification();
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_SANDBOX, false);
sandboxExchangeSpecification.setExchangeSpecificParametersItem(Parameters.PARAM_USE_PRIME, true);
sandboxExchangeSpecification.setOverrideWebsocketApiUri(overrideWebsocketApiUri);
sandboxExchangeSpecification.setShouldLoadRemoteMetaData(false);
final CoinbaseProStreamingExchange exchange = (CoinbaseProStreamingExchange) StreamingExchangeFactory.INSTANCE.createExchange(sandboxExchangeSpecification);
assertThat(exchange.getApiUri()).isEqualTo(overrideWebsocketApiUri);
assertThat(exchange.getExchangeSpecification().getOverrideWebsocketApiUri()).isEqualTo(overrideWebsocketApiUri);
}
Aggregations