Examples of BitfinexDepth


Examples of com.xeiam.xchange.bitfinex.v1.dto.marketdata.BitfinexDepth

  @Test
  public void testMarketDepth() throws Exception {

    InputStream resourceAsStream = BitfinexMarketDataJSONTest.class.getResourceAsStream("/v1/marketdata/example-marketdepth-data.json");
    BitfinexDepth depthRaw = new ObjectMapper().readValue(resourceAsStream, BitfinexDepth.class);
    BitfinexAdapters.OrdersContainer asksOrdersContainer = BitfinexAdapters.adaptOrders(depthRaw.getAsks(), CurrencyPair.BTC_EUR, OrderType.ASK);
    BitfinexAdapters.OrdersContainer bidsOrdersContainer = BitfinexAdapters.adaptOrders(depthRaw.getBids(), CurrencyPair.BTC_EUR, OrderType.BID);

    assertEquals(new BigDecimal("851.87"), asksOrdersContainer.getLimitOrders().get(0).getLimitPrice());
    assertEquals(new BigDecimal("849.59"), bidsOrdersContainer.getLimitOrders().get(0).getLimitPrice());

    assertThat(asksOrdersContainer.getTimestamp()).isEqualTo(1387060950000L);
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.marketdata.BitfinexDepth

  }

  public BitfinexDepth getBitfinexOrderBook(String pair, Integer limitBids, Integer limitAsks) throws IOException {

    try {
      BitfinexDepth bitfinexDepth;
      if (limitBids == null && limitAsks == null) {
        bitfinexDepth = bitfinex.getBook(pair);
      }
      else {
        bitfinexDepth = bitfinex.getBook(pair, limitBids, limitAsks);
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.marketdata.BitfinexDepth

      else {
        limitAsks = (Integer) arg1;
      }
    }

    BitfinexDepth bitfinexDepth = getBitfinexOrderBook(BitfinexUtils.toPairString(currencyPair), limitBids, limitAsks);

    OrderBook orderBook = BitfinexAdapters.adaptOrderBook(bitfinexDepth, currencyPair);

    return orderBook;
  }
View Full Code Here

Examples of com.xeiam.xchange.bitfinex.v1.dto.marketdata.BitfinexDepth

  }

  private static void raw(BitfinexMarketDataServiceRaw marketDataService) throws IOException {

    // Get the latest order book data for BTC/CAD
    BitfinexDepth bitfinexDepth = marketDataService.getBitfinexOrderBook("btcusd", 50, 50);

    System.out.println("Current Order Book size for BTC / USD: " + (bitfinexDepth.getAsks().length + bitfinexDepth.getBids().length));

    System.out.println("First Ask: " + bitfinexDepth.getAsks()[0].toString());

    System.out.println("First Bid: " + bitfinexDepth.getBids()[0].toString());

    System.out.println(bitfinexDepth.toString());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.