Package com.xeiam.xchange.btcchina.dto.marketdata

Examples of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaDepth


  @Override
  public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args) throws IOException {

    // Request data
    final BTCChinaDepth btcChinaDepth;
    final String market = BTCChinaAdapters.adaptMarket(currencyPair);

    if (args.length == 0) {
      btcChinaDepth = getBTCChinaOrderBook(market);
    }
View Full Code Here


  }

  @Test
  public void testAdaptOrderBookBTCChinaDepth() throws IOException {

    BTCChinaDepth btcChinaDepth = mapper.readValue(getClass().getResource("/marketdata/example-depth-data.json"), BTCChinaDepth.class);
    OrderBook orderBook = BTCChinaAdapters.adaptOrderBook(btcChinaDepth, CurrencyPair.BTC_CNY);

    List<LimitOrder> bids = orderBook.getBids();
    List<LimitOrder> asks = orderBook.getAsks();
View Full Code Here

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

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

    // Verify that the example data was unmarshalled correctly
    assertThat(btcChinaDepth.getAsks().get(0)[0]).isEqualTo(new BigDecimal("1.0e+14"));
  }
View Full Code Here

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

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

    List<LimitOrder> asks = BTCChinaAdapters.adaptOrders(BTCChinaDepth.getAsks(), CurrencyPair.BTC_CNY, OrderType.ASK);

    // Verify all fields filled
    assertThat(asks.get(0).getLimitPrice().doubleValue()).isEqualTo(1.0e+14);
    assertThat(asks.get(0).getType()).isEqualTo(OrderType.ASK);
    assertThat(asks.get(0).getTradableAmount().doubleValue()).isEqualTo(0.031);
View Full Code Here

  }

  public static void raw() throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    // Get the latest order book data for BTC/CNY
    BTCChinaDepth orderBook = ((BTCChinaMarketDataServiceRaw) marketDataService).getBTCChinaOrderBook(BTCChinaExchange.DEFAULT_MARKET, 10);

    System.out.println("Date: " + orderBook.getDate());
    System.out.println(orderBook.toString());

    // first item in each BigDecial[] will be price (in RMB), and second will be volume/depth.
    System.out.println("Asks:");
    for (BigDecimal[] currRow : orderBook.getAsks()) {
      for (BigDecimal currItem : currRow) {
        System.out.print(currItem.toPlainString() + ", ");
      }
      System.out.println();
    }

    System.out.println("Bids:");
    for (BigDecimal[] currRow : orderBook.getBids()) {
      for (BigDecimal currItem : currRow) {
        System.out.print(currItem.toPlainString() + ", ");
      }
      System.out.println();
    }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.btcchina.dto.marketdata.BTCChinaDepth

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.