Search in sources :

Example 1 with BitsoOrderBook

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);
}
Also used : BitsoOrderBook(org.knowm.xchange.bitso.dto.marketdata.BitsoOrderBook) OrderBook(org.knowm.xchange.dto.marketdata.OrderBook) LimitOrder(org.knowm.xchange.dto.trade.LimitOrder) Date(java.util.Date)

Example 2 with BitsoOrderBook

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());
}
Also used : BitsoTicker(org.knowm.xchange.bitso.dto.marketdata.BitsoTicker) BitsoOrderBook(org.knowm.xchange.bitso.dto.marketdata.BitsoOrderBook)

Aggregations

BitsoOrderBook (org.knowm.xchange.bitso.dto.marketdata.BitsoOrderBook)2 Date (java.util.Date)1 BitsoTicker (org.knowm.xchange.bitso.dto.marketdata.BitsoTicker)1 OrderBook (org.knowm.xchange.dto.marketdata.OrderBook)1 LimitOrder (org.knowm.xchange.dto.trade.LimitOrder)1