Search in sources :

Example 1 with HitbtcTicker

use of org.knowm.xchange.hitbtc.v2.dto.HitbtcTicker in project XChange by knowm.

the class HitbtcMarketDataDemo method raw.

private static void raw(HitbtcMarketDataServiceRaw marketDataService) throws IOException {
    HitbtcTicker ticker = marketDataService.getHitbtcTicker(CurrencyPair.BTC_USD);
    System.out.println("BTC/USD Ticker: " + ticker.toString());
    Map<String, HitbtcTicker> tickers = marketDataService.getHitbtcTickers();
    System.out.println("All Tickers: " + tickers.toString());
    // Get the latest order book data for BTC/USD
    HitbtcOrderBook orderBook = marketDataService.getHitbtcOrderBook(CurrencyPair.BTC_USD);
    System.out.println("Current Order Book size for BTC/USD: " + (orderBook.getAsks().length + orderBook.getBids().length));
    System.out.println(orderBook);
}
Also used : HitbtcOrderBook(org.knowm.xchange.hitbtc.v2.dto.HitbtcOrderBook) HitbtcTicker(org.knowm.xchange.hitbtc.v2.dto.HitbtcTicker)

Example 2 with HitbtcTicker

use of org.knowm.xchange.hitbtc.v2.dto.HitbtcTicker in project XChange by knowm.

the class HitbtcAdapters method adaptTicker.

public static Ticker adaptTicker(HitbtcTicker hitbtcTicker, CurrencyPair currencyPair) {
    BigDecimal bid = hitbtcTicker.getBid();
    BigDecimal ask = hitbtcTicker.getAsk();
    BigDecimal high = hitbtcTicker.getHigh();
    BigDecimal low = hitbtcTicker.getLow();
    BigDecimal last = hitbtcTicker.getLast();
    BigDecimal volume = hitbtcTicker.getVolume();
    Date timestamp = hitbtcTicker.getTimestamp();
    return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).timestamp(timestamp).build();
}
Also used : HitbtcTicker(org.knowm.xchange.hitbtc.v2.dto.HitbtcTicker) Ticker(org.knowm.xchange.dto.marketdata.Ticker) BigDecimal(java.math.BigDecimal) Date(java.util.Date)

Aggregations

HitbtcTicker (org.knowm.xchange.hitbtc.v2.dto.HitbtcTicker)2 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 Ticker (org.knowm.xchange.dto.marketdata.Ticker)1 HitbtcOrderBook (org.knowm.xchange.hitbtc.v2.dto.HitbtcOrderBook)1