Examples of VirtExDepth


Examples of com.xeiam.xchange.virtex.v1.dto.marketdata.VirtExDepth

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

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

    List<LimitOrder> asks = VirtExAdapters.adaptOrders(VirtExDepth.getAsks(), "CAD", "ask", "");

    // Verify all fields filled
    assertThat(asks.get(0).getLimitPrice().doubleValue()).isEqualTo(16.90536);
    assertThat(asks.get(0).getType()).isEqualTo(OrderType.ASK);
    assertThat(asks.get(0).getTradableAmount().doubleValue()).isEqualTo(6.51);
View Full Code Here

Examples of com.xeiam.xchange.virtex.v1.dto.marketdata.VirtExDepth

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

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

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

Examples of com.xeiam.xchange.virtex.v1.dto.marketdata.VirtExDepth

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

    // Request data
    VirtExDepth virtExDepth = getVirtExOrderBook(currencyPair.counterSymbol);

    // Adapt to XChange DTOs
    List<LimitOrder> asks = VirtExAdapters.adaptOrders(virtExDepth.getAsks(), currencyPair.counterSymbol, "ask", "");
    List<LimitOrder> bids = VirtExAdapters.adaptOrders(virtExDepth.getBids(), currencyPair.counterSymbol, "bid", "");

    return new OrderBook(null, asks, bids);
  }
View Full Code Here

Examples of com.xeiam.xchange.virtex.v1.dto.marketdata.VirtExDepth

  }

  public VirtExDepth getVirtExOrderBook(String currency) throws IOException {

    // Request data
    VirtExDepth virtExDepth = virtEx.getFullDepth(currency);

    return virtExDepth;
  }
View Full Code Here

Examples of com.xeiam.xchange.virtex.v2.dto.marketdata.VirtExDepth

  }

  private static void raw(VirtExMarketDataServiceRaw marketDataService) throws IOException {

    // Get the latest order book data for BTC/CAD
    VirtExDepth orderBook = marketDataService.getVirtExOrderBook(CurrencyPair.BTC_CAD);

    System.out.println("Current Order Book size for BTC / CAD: " + (orderBook.getAsks().size() + orderBook.getBids().size()));

    System.out.println("Last Ask: " + orderBook.getAsks().get(0)[0].toString());

    System.out.println("Last Bid: " + orderBook.getBids().get(0)[0].toString());

    System.out.println(orderBook.toString());
  }
View Full Code Here

Examples of com.xeiam.xchange.virtex.v2.dto.marketdata.VirtExDepth

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

    // Request data
    VirtExDepth virtExDepth = getVirtExOrderBook(currencyPair);

    // Adapt to XChange DTOs
    List<LimitOrder> asks = VirtExAdapters.adaptOrders(virtExDepth.getAsks(), currencyPair, "ask", "");
    Collections.reverse(asks);
    List<LimitOrder> bids = VirtExAdapters.adaptOrders(virtExDepth.getBids(), currencyPair, "bid", "");

    return new OrderBook(null, asks, bids);
  }
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.