use of org.knowm.xchange.service.marketdata.MarketDataService in project XChange by knowm.
the class TickerFetchIntegration method tickerFetchTest.
@Test
public void tickerFetchTest() throws Exception {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(BitsoExchange.class);
exchange.remoteInit();
MarketDataService marketDataService = exchange.getMarketDataService();
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_MXN);
System.out.println(ticker.toString());
assertThat(ticker).isNotNull();
}
use of org.knowm.xchange.service.marketdata.MarketDataService in project XChange by knowm.
the class CoinfloorPublicTradesIntegration method fetchTransactionTest.
@Test
public void fetchTransactionTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
Trades trades = service.getTrades(CurrencyPair.BTC_GBP, CoinfloorInterval.HOUR);
assertThat(trades.getTrades()).isNotEmpty();
int tradeCount = trades.getTrades().size();
Trade mostRecentTrade = trades.getTrades().get(tradeCount - 1);
assertThat(mostRecentTrade.getPrice()).isGreaterThan(BigDecimal.ZERO);
assertThat(mostRecentTrade.getOriginalAmount()).isGreaterThan(BigDecimal.ZERO);
assertThat(trades.getlastID()).isEqualTo(Long.parseLong(mostRecentTrade.getId()));
}
use of org.knowm.xchange.service.marketdata.MarketDataService in project XChange by knowm.
the class CoinfloorTickerIntegration method fetchTickerTest.
@Test
public void fetchTickerTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
Ticker ticker = service.getTicker(CurrencyPair.BTC_GBP);
assertThat(ticker.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_GBP);
assertThat(ticker.getLast()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getHigh()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getLow()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getVwap()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getVolume()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getBid()).isGreaterThan(BigDecimal.ZERO);
assertThat(ticker.getAsk()).isGreaterThan(BigDecimal.ZERO);
}
use of org.knowm.xchange.service.marketdata.MarketDataService in project XChange by knowm.
the class CoinfloorOrderBookIntegration method fetchOrderBookTest.
@Test
public void fetchOrderBookTest() throws IOException {
Exchange exchange = ExchangeFactory.INSTANCE.createExchange(CoinfloorExchange.class);
MarketDataService service = exchange.getMarketDataService();
OrderBook orderBook = service.getOrderBook(CurrencyPair.BTC_GBP);
assertThat(orderBook.getBids()).isNotEmpty();
assertThat(orderBook.getAsks()).isNotEmpty();
LimitOrder order = orderBook.getBids().get(0);
assertThat(order.getCurrencyPair()).isEqualTo(CurrencyPair.BTC_GBP);
assertThat(order.getOriginalAmount()).isGreaterThan(BigDecimal.ZERO);
assertThat(order.getLimitPrice()).isGreaterThan(BigDecimal.ZERO);
}
use of org.knowm.xchange.service.marketdata.MarketDataService in project XChange by knowm.
the class KucoinMarketDataDemo method main.
public static void main(String[] args) throws IOException {
exchange = ExchangeFactory.INSTANCE.createExchange(KucoinExchange.class);
MarketDataService marketDataService = exchange.getMarketDataService();
System.out.println(Arrays.toString(exchange.getExchangeSymbols().toArray()));
generic(marketDataService);
raw((KucoinMarketDataService) marketDataService);
}
Aggregations