use of org.knowm.xchange.currency.CurrencyPair 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 org.knowm.xchange.currency.CurrencyPair 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.currency.CurrencyPair in project XChange by knowm.
the class ExchangeMetaDataIntegration method testLtcBtcPairMetaData.
@Test
public void testLtcBtcPairMetaData() {
CurrencyPairMetaData pairMetaData = metaData.getCurrencyPairs().get(new CurrencyPair("LTC/BTC"));
assertThat(pairMetaData.getPriceScale()).isEqualByComparingTo(6);
assertThat(pairMetaData.getMinimumAmount()).isEqualByComparingTo("0.01");
assertThat(pairMetaData.getMaximumAmount().longValueExact()).isEqualTo(100000);
assertThat(pairMetaData.getAmountStepSize()).isEqualByComparingTo("0.01");
}
use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.
the class AccountServiceIntegration method testMetaData.
@Test
public void testMetaData() throws Exception {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = exchange.getExchangeMetaData().getCurrencyPairs();
Map<Currency, CurrencyMetaData> currencies = exchange.getExchangeMetaData().getCurrencies();
CurrencyPair currPair;
Currency curr;
currPair = currencyPairs.keySet().stream().filter(cp -> "ETH/BTC".equals(cp.toString())).collect(StreamUtils.singletonCollector());
Assert.assertNotNull(currPair);
curr = currencies.keySet().stream().filter(c -> Currency.BTC.equals(c)).collect(StreamUtils.singletonCollector());
Assert.assertNotNull(curr);
Assert.assertNotNull(curr);
}
use of org.knowm.xchange.currency.CurrencyPair in project XChange by knowm.
the class MarketDataServiceResilienceTest method shouldSucceedIfFirstCallTimeoutedAndRetryIsEnabled.
@Test
public void shouldSucceedIfFirstCallTimeoutedAndRetryIsEnabled() throws Exception {
// given
MarketDataService service = createExchangeWithRetryEnabled().getMarketDataService();
stubForTicker24WithFirstCallTimetoutAndSecondSuccessful();
// when
Ticker ticker = service.getTicker(new CurrencyPair("BNB", "BTC"));
// then
assertThat(ticker.getLast()).isEqualByComparingTo("4.00000200");
}
Aggregations