Package com.xeiam.xchange.bitstamp.dto.marketdata

Examples of com.xeiam.xchange.bitstamp.dto.marketdata.BitstampStreamingOrderBook


    // Read in the JSON from the example resources
    InputStream is = StreamDepthJSONTest.class.getResourceAsStream("/marketdata/example-stream-depth-data.json");

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

    // Verify that the example data was unmarshalled correctly
    assertThat(orderBook.getBids().get(0).get(0)).isEqualTo(new BigDecimal("123.09"));
    assertThat(orderBook.getBids().get(0).get(1)).isEqualTo(new BigDecimal("0.16248274"));
    assertThat(orderBook.getAsks().get(0).get(0)).isEqualTo(new BigDecimal("123.39"));
    assertThat(orderBook.getAsks().get(0).get(1)).isEqualTo(new BigDecimal("0.60466812"));
    assertThat(orderBook.getTimestamp() > 0);
  }
View Full Code Here


    chan.bind("data", listener);
  }

  private OrderBook parseOrderBook(String rawJson) throws IOException {

    BitstampStreamingOrderBook nativeBook = streamObjectMapper.readValue(rawJson, BitstampStreamingOrderBook.class);
    // BitstampOrderBook nativeBook = new BitstampOrderBook((new Date()).getTime(), json.get("bids"), json.get("asks"));
    return BitstampAdapters.adaptOrderBook(nativeBook, CurrencyPair.BTC_USD, 1);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.bitstamp.dto.marketdata.BitstampStreamingOrderBook

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.