use of org.knowm.xchange.dto.marketdata.Ticker 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.dto.marketdata.Ticker 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.dto.marketdata.Ticker in project XChange by knowm.
the class CmcAdapter method adaptTickerList.
public static List<Ticker> adaptTickerList(List<CmcTicker> cmcTickerList) {
List<Ticker> tickerList = new ArrayList<>();
cmcTickerList.forEach(cmcTicker -> {
cmcTicker.getQuote().forEach((currencySymbol, quote) -> {
CurrencyPair pair = new CurrencyPair(cmcTicker.getSymbol(), currencySymbol);
tickerList.add(adaptTicker(cmcTicker, pair));
});
});
return tickerList;
}
use of org.knowm.xchange.dto.marketdata.Ticker in project XChange by knowm.
the class TickerDemo method generic.
private static void generic(MarketDataService marketDataService) throws IOException {
Ticker ticker = marketDataService.getTicker(new CurrencyPair(Currency.LTC, Currency.BRL));
System.out.println(ticker.toString());
}
use of org.knowm.xchange.dto.marketdata.Ticker in project XChange by knowm.
the class KrakenTickerDemo method generic.
private static void generic(Exchange krakenExchange) throws IOException {
// Interested in the public market data feed (no authentication)
MarketDataService marketDataService = krakenExchange.getMarketDataService();
// Get the latest ticker data showing BTC to EUR
Ticker ticker = marketDataService.getTicker(CurrencyPair.BTC_EUR);
System.out.println("Ticker: " + ticker.toString());
System.out.println("Currency: " + Currency.EUR);
System.out.println("Last: " + ticker.getLast().toString());
System.out.println("Volume: " + ticker.getVolume().toString());
System.out.println("High: " + ticker.getHigh().toString());
System.out.println("Low: " + ticker.getLow().toString());
}
Aggregations