Package com.xeiam.xchange.virtex.v1.service

Examples of com.xeiam.xchange.virtex.v1.service.VirtExAdapterTest


    // 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


    // 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

  @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

  }

  public VirtExDepth getVirtExOrderBook(String currency) throws IOException {

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

    return virtExDepth;
  }
View Full Code Here

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

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

    Ticker ticker = VirtExAdapters.adaptTicker(VirtExTicker, CurrencyPair.BTC_CAD);
    System.out.println(ticker.toString());

    assertThat(ticker.getLast().toString()).isEqualTo("12.32900");
View Full Code Here

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

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

    // Verify that the example data was unmarshalled correctly
    assertThat(VirtExTicker.getLast()).isEqualTo(new BigDecimal("12.32900"));
    assertThat(VirtExTicker.getHigh()).isEqualTo(new BigDecimal("12.37989"));
    assertThat(VirtExTicker.getLow()).isEqualTo(new BigDecimal("11.64001"));
    assertThat(VirtExTicker.getVolume()).isEqualTo(new BigDecimal("1866.56"));
  }
View Full Code Here

  }

  public VirtExTicker getVirtExTicker(String currency) throws IOException {

    // Request data
    VirtExTicker virtExTicker = virtEx.getTicker(currency);

    // Adapt to XChange DTOs
    return virtExTicker;
  }
View Full Code Here

  @Override
  public void applySpecification(ExchangeSpecification exchangeSpecification) {

    super.applySpecification(exchangeSpecification);
    this.pollingMarketDataService = new VirtExMarketDataService(exchangeSpecification);
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.virtex.v1.service.VirtExAdapterTest

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.