Examples of BTCChinaOrder


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

    assertEquals(new BigDecimal("5.00000000"), io.getDisclosedAmount());
    assertEquals(new BigDecimal("0.10"), io.getVariance());
    assertEquals(1405412126L, io.getDate());
    assertEquals("open", io.getStatus());

    BTCChinaOrder o = io.getOrders()[0];
    assertEquals(3301L, o.getId());
    assertEquals("bid", o.getType());
    assertEquals(new BigDecimal("40.00"), o.getPrice());
    assertEquals("CNY", o.getCurrency());
    assertEquals(new BigDecimal("4.67700000"), o.getAmount());
    assertEquals(new BigDecimal("4.67700000"), o.getAmountOriginal());
    assertEquals(1405412126L, o.getDate());
    assertEquals("open", o.getStatus());
  }
View Full Code Here

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

  @Test
  public void testBTCChinaGetOrderResponse() throws IOException {

    BTCChinaGetOrderResponse response = mapper.readValue(getClass().getResource("getOrder.json"), BTCChinaGetOrderResponse.class);
    BTCChinaOrder order = response.getResult().getOrder();
    assertOrder(order);
    assertNull(order.getDetails());
  }
View Full Code Here

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

  @Test
  public void testBTCChinaGetOrderResponseWithdetail() throws IOException {

    BTCChinaGetOrderResponse response = mapper.readValue(getClass().getResource("getOrder-withdetail.json"), BTCChinaGetOrderResponse.class);
    BTCChinaOrder order = response.getResult().getOrder();
    assertOrder(order);
    assertEquals(1403170822L, order.getDetails()[0].getDateline());
    assertEquals(new BigDecimal("3811.69"), order.getDetails()[0].getPrice());
    assertEquals(new BigDecimal("0.031"), order.getDetails()[0].getAmount());
  }
View Full Code Here

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

    else {
      response = tradeServiceRaw.getBTCChinaOrder(orderId, market, withdetail);
    }
    System.out.println(response);

    BTCChinaOrder order = response.getResult().getOrder();
    System.out.println("OrderID:\t" + order.getId());
    System.out.println("Side:\t" + order.getType());
    System.out.println("Price:\t" + order.getPrice());
    System.out.println("Currency: \t" + order.getCurrency());
    System.out.println("LeavesQty:\t" + order.getAmount());
    System.out.println("OrderQty:\t" + order.getAmountOriginal());
    System.out.println("CumQty:\t" + order.getAmountOriginal().subtract(order.getAmount()));
    System.out.println("Date:\t" + new Date(order.getDate() * 1000));
    System.out.println("Status:\t" + order.getStatus());
    if (order.getDetails() != null) {
      for (BTCChinaOrderDetail detail : order.getDetails()) {
        System.out.println("--");
        System.out.println("dateline:\t" + detail.getDateline());
        System.out.println("price:\t" + detail.getPrice());
        System.out.println("amount:\t" + detail.getAmount());
      }
View Full Code Here

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

    Thread.sleep(1500);
    BTCChinaResponse<BTCChinaOrders> openOrders = printOpenOrdersRaw();

    long result = -1;
    for (int i = 0; i < openOrders.getResult().getOrders().size(); i++) {
      BTCChinaOrder order = openOrders.getResult().getOrders().get(i);
      int orderId = order.getId();
      if (order.getType().equals(limitOrder.getType().toString()) && order.getPrice().compareTo(limitOrder.getLimitPrice()) == 0 && orderId > result) {
        result = orderId;
      }
    }

    // Cancel the added order
View Full Code Here

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

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

  @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
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.