Search in sources :

Example 1 with KrakenTicker

use of org.knowm.xchange.kraken.dto.marketdata.KrakenTicker in project XChange by knowm.

the class KrakenAdapters method adaptTickers.

public static List<Ticker> adaptTickers(Map<String, KrakenTicker> krakenTickers) {
    List<Ticker> tickers = new ArrayList<>();
    for (Entry<String, KrakenTicker> ticker : krakenTickers.entrySet()) {
        CurrencyPair pair = KrakenUtils.translateKrakenCurrencyPair(ticker.getKey());
        tickers.add(adaptTicker(ticker.getValue(), pair));
    }
    return tickers;
}
Also used : KrakenTicker(org.knowm.xchange.kraken.dto.marketdata.KrakenTicker) KrakenTicker(org.knowm.xchange.kraken.dto.marketdata.KrakenTicker) Ticker(org.knowm.xchange.dto.marketdata.Ticker) ArrayList(java.util.ArrayList) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Example 2 with KrakenTicker

use of org.knowm.xchange.kraken.dto.marketdata.KrakenTicker in project XChange by knowm.

the class KrakenTickerDemo method raw.

private static void raw(Exchange krakenExchange) throws IOException {
    // Interested in the public market data feed (no authentication)
    KrakenMarketDataServiceRaw krakenMarketDataService = (KrakenMarketDataServiceRaw) krakenExchange.getMarketDataService();
    // Get the latest ticker data showing BTC to EUR
    KrakenTicker ticker = krakenMarketDataService.getKrakenTicker(CurrencyPair.BTC_EUR);
    System.out.println("Ticker: " + ticker.toString());
    System.out.println("Currency: " + Currency.EUR);
    System.out.println("Last: " + ticker.getClose());
    System.out.println("Volume: " + ticker.get24HourVolume().toString());
    System.out.println("High: " + ticker.get24HourHigh().toString());
    System.out.println("Low: " + ticker.get24HourLow().toString());
}
Also used : KrakenMarketDataServiceRaw(org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw) KrakenTicker(org.knowm.xchange.kraken.dto.marketdata.KrakenTicker)

Aggregations

KrakenTicker (org.knowm.xchange.kraken.dto.marketdata.KrakenTicker)2 ArrayList (java.util.ArrayList)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 Ticker (org.knowm.xchange.dto.marketdata.Ticker)1 KrakenMarketDataServiceRaw (org.knowm.xchange.kraken.service.KrakenMarketDataServiceRaw)1