Package com.xeiam.xchange.dto.marketdata

Examples of com.xeiam.xchange.dto.marketdata.OrderBook


    final ObjectMapper mapper = new ObjectMapper();
    final JavaType tickersType = mapper.getTypeFactory().constructParametricType(MintPalBaseResponse.class, mapper.getTypeFactory().constructCollectionType(List.class, MintPalPublicOrders.class));
    final MintPalBaseResponse<List<MintPalPublicOrders>> ordersResponse = mapper.readValue(is, tickersType);

    final List<MintPalPublicOrders> orderbook = ordersResponse.getData();
    final OrderBook adaptedOrderbook = MintPalAdapters.adaptOrderBook(CurrencyPair.LTC_BTC, orderbook);

    final List<LimitOrder> asks = adaptedOrderbook.getAsks();
    assertThat(asks).hasSize(2);

    final LimitOrder ask = asks.get(0);
    assertThat(ask.getLimitPrice()).isEqualTo("0.01289999");
    assertThat(ask.getTradableAmount()).isEqualTo("0.04599935");
View Full Code Here


    List<LimitOrder> bids = adaptMarketOrderToLimitOrder(marketDepth.getBids(), OrderType.BID, currencyPair);
    Collections.reverse(bids);

    // TODO
    // What timestamp should be used? Latest/Earliest/Current one?
    return new OrderBook(new Date(), asks, bids);
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    CryptsyOrderBookReturn cryptsyOrderBook = mapper.readValue(is, CryptsyOrderBookReturn.class);

    OrderBook adaptedOrderBook = CryptsyAdapters.adaptOrderBook(cryptsyOrderBook, CurrencyPair.WDC_BTC);

    assertEquals(adaptedOrderBook.getAsks().size(), cryptsyOrderBook.getReturnValue().sellOrders().size());
    assertEquals(adaptedOrderBook.getBids().size(), cryptsyOrderBook.getReturnValue().buyOrders().size());
    assertNotNull(adaptedOrderBook.getTimeStamp());
  }
View Full Code Here

    Map<Integer, CryptsyPublicOrderbook> cryptsyOrderBookMap = CryptsyAdapters.adaptPublicOrderBookMap(mapper.readValue(is, CryptsyPublicOrderbookReturn.class).getReturnValue());

    List<OrderBook> adaptedOrderBookList = CryptsyAdapters.adaptPublicOrderBooks(cryptsyOrderBookMap);
    assertThat(adaptedOrderBookList).hasSize(1);

    OrderBook adaptedOrderBook = adaptedOrderBookList.get(0);
    assertEquals(adaptedOrderBook.getAsks().size(), 3);
    assertEquals(adaptedOrderBook.getBids().size(), 3);
    assertNotNull(adaptedOrderBook.getTimeStamp());

    LimitOrder asks = adaptedOrderBook.getAsks().get(0);
    assertThat(asks.getCurrencyPair()).isEqualTo(CurrencyPair.DOGE_LTC);
    assertThat(asks.getId()).isNull();
    assertThat(asks.getLimitPrice()).isEqualTo("0.00003495");
    assertThat(asks.getTradableAmount()).isEqualTo("334369.75217020");
    assertThat(asks.getType()).isEqualTo(OrderType.ASK);
View Full Code Here

    BTCEDepth btceDepth = btce.getDepth(currencyPair.baseSymbol.toLowerCase(), currencyPair.counterSymbol.toLowerCase());
    // Adapt to XChange DTOs
    List<LimitOrder> asks = BTCEAdapters.adaptOrders(btceDepth.getAsks(), currencyPair, "ask", "");
    List<LimitOrder> bids = BTCEAdapters.adaptOrders(btceDepth.getBids(), currencyPair, "bid", "");

    return new OrderBook(null, asks, bids);
  }
View Full Code Here

    // Adapt to XChange DTOs
    List<LimitOrder> asks = BTCEAdapters.adaptOrders(btceDepthWrapper.getDepth(BTCEUtils.getPair(currencyPair)).getAsks(), currencyPair, "ask", "");
    List<LimitOrder> bids = BTCEAdapters.adaptOrders(btceDepthWrapper.getDepth(BTCEUtils.getPair(currencyPair)).getBids(), currencyPair, "bid", "");

    return new OrderBook(null, asks, bids);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.marketdata.OrderBook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.