Package com.xeiam.xchange.btcchina.dto.trade.streaming

Examples of com.xeiam.xchange.btcchina.dto.trade.streaming.BTCChinaOrder


  }

  private static BTCChinaOrder internalAdaptOrder(JSONObject jsonObject) throws JSONException {

    JSONObject orderJsonObject = jsonObject.getJSONObject("order");
    return new BTCChinaOrder(BTCChinaAdapters.adaptOrderType(orderJsonObject.getString("type")), new BigDecimal(orderJsonObject.getString("amount")), BTCChinaAdapters
        .adaptCurrencyPair(orderJsonObject.getString("market")), String.valueOf(orderJsonObject.getLong("id")), BTCChinaAdapters.adaptDate(orderJsonObject.getLong("date")), new BigDecimal(
        orderJsonObject.getString("price")), new BigDecimal(orderJsonObject.getString("amount_original")), BTCChinaAdapters.adaptOrderStatus(orderJsonObject.getString("status")));
  }
View Full Code Here


  @Test
  public void testAdaptOrder() throws JSONException, IOException {

    JSONObject jsonObject = new JSONObject(IOUtils.toString(getClass().getResource("order.json"), Charsets.UTF_8));
    BTCChinaOrder order = BTCChinaJSONObjectAdapters.adaptOrder(jsonObject);
    assertEquals(new BigDecimal("0.01"), order.getTradableAmount());
    assertEquals("26821399", order.getId());
    assertEquals(new BigDecimal("3605.23"), order.getLimitPrice());
    assertEquals(CurrencyPair.BTC_CNY, order.getCurrencyPair());
    assertEquals(BTCChinaOrderStatus.CANCELLED, order.getStatus());
    assertEquals(1411924393000L, order.getTimestamp().getTime());
    assertEquals(OrderType.ASK, order.getType());
    assertEquals(new BigDecimal("0.01"), order.getAmountOriginal());
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.btcchina.dto.trade.streaming.BTCChinaOrder

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.