Examples of ANXDepth


Examples of com.xeiam.xchange.anx.v2.dto.marketdata.ANXDepth

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

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

    // Verify that the example data was unmarshalled correctly
    // assertThat(anxFullDepth.getAsks().get(0).getAmountInt()).isEqualTo(727610000L);

    Assert.assertEquals(new Long(1392693096241000L), anxFullDepth.getMicroTime());
    Assert.assertEquals(3, anxFullDepth.getAsks().size());
    Assert.assertEquals(new BigDecimal("3260.40000"), anxFullDepth.getAsks().get(0).getPrice());
    Assert.assertEquals(326040000L, anxFullDepth.getAsks().get(0).getPriceInt());
    Assert.assertEquals(new BigDecimal("16.00000000"), anxFullDepth.getAsks().get(0).getAmount());
    Assert.assertEquals(1600000000L, anxFullDepth.getAsks().get(0).getAmountInt());

    Assert.assertEquals(4, anxFullDepth.getBids().size());
    Assert.assertEquals(new BigDecimal("2000.00000"), anxFullDepth.getBids().get(0).getPrice());
    Assert.assertEquals(200000000L, anxFullDepth.getBids().get(0).getPriceInt());
    Assert.assertEquals(new BigDecimal("3.00000000"), anxFullDepth.getBids().get(0).getAmount());
    Assert.assertEquals(300000000L, anxFullDepth.getBids().get(0).getAmountInt());

  }
View Full Code Here

Examples of com.xeiam.xchange.anx.v2.dto.marketdata.ANXDepth

    InputStream is = ANXAdapterTest.class.getResourceAsStream("/v2/marketdata/example-fulldepth-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXDepth anxDepth = mapper.readValue(is, ANXDepth.class);

    List<LimitOrder> asks = ANXAdapters.adaptOrders(anxDepth.getAsks(), "BTC", "USD", "ask", "id_567");
    Assert.assertEquals(3, asks.size());

    // Verify all fields filled
    assertThat(asks.get(0).getType()).isEqualTo(OrderType.ASK);
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.