use of org.knowm.xchange.bitso.dto.marketdata.BitsoOrderBook in project XChange by knowm.
the class BitsoAdapters method adaptOrderBook.
public static OrderBook adaptOrderBook(BitsoOrderBook bitsoOrderBook, CurrencyPair currencyPair, int timeScale) {
List<LimitOrder> asks = createOrders(currencyPair, Order.OrderType.ASK, bitsoOrderBook.getAsks());
List<LimitOrder> bids = createOrders(currencyPair, Order.OrderType.BID, bitsoOrderBook.getBids());
Date date = new Date(bitsoOrderBook.getTimestamp() * // polled order books provide a timestamp in seconds, stream in ms
timeScale);
return new OrderBook(date, asks, bids);
}
use of org.knowm.xchange.bitso.dto.marketdata.BitsoOrderBook in project XChange by knowm.
the class BitsoMarketDataDemo method raw.
private static void raw(BitsoMarketDataServiceRaw marketDataService) throws IOException {
BitsoTicker ticker = marketDataService.getBitsoTicker(CurrencyPair.BTC_MXN);
System.out.println("Ticker: " + ticker);
// Get the latest order book data for BTCMXN
BitsoOrderBook orderBook = marketDataService.getBitsoOrderBook(CurrencyPair.BTC_MXN);
System.out.println("Current Order Book size for BTC / MXN: " + (orderBook.getAsks().size() + orderBook.getBids().size()));
System.out.println("First Ask: " + orderBook.getAsks().get(0).toString());
System.out.println("First Bid: " + orderBook.getBids().get(0).toString());
System.out.println(orderBook.toString());
}
Aggregations