Examples of CryptonitRate


Examples of com.xeiam.xchange.cryptonit.v2.dto.marketdata.CryptonitRate

   * @param cryptonitTicker
   * @return
   */
  public static Ticker adaptTicker(CryptonitTicker cryptonitTicker, CurrencyPair currencyPair) {

    CryptonitRate rate = cryptonitTicker.getRate();

    BigDecimal last = rate.getLast();
    BigDecimal high = rate.getHigh();
    BigDecimal low = rate.getLow();
    BigDecimal bid = rate.getBid();
    BigDecimal ask = rate.getAsk();
    BigDecimal volume = cryptonitTicker.getVolume().getVolume(currencyPair.baseSymbol);

    return new Ticker.Builder().currencyPair(currencyPair).last(last).high(high).low(low).bid(bid).ask(ask).volume(volume).build();
  }
View Full Code Here

Examples of com.xeiam.xchange.cryptonit.v2.dto.marketdata.CryptonitRate

    InputStream is = CryptonitTickerJSONTest.class.getResourceAsStream("/marketdata/example-ticker-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    CryptonitTicker cryptonitTicker = mapper.readValue(is, CryptonitTicker.class);
    CryptonitRate cryptonitTickerRate = cryptonitTicker.getRate();

    // Verify that the example data was unmarshalled correctly
    assertThat(cryptonitTickerRate.getLast()).isEqualTo(new BigDecimal("605.997"));
    assertThat(cryptonitTickerRate.getHigh()).isEqualTo(new BigDecimal("610.00000000"));
    assertThat(cryptonitTickerRate.getLow()).isEqualTo(new BigDecimal("572.73768613"));
    assertThat(cryptonitTicker.getVolume().getVolume("BTC")).isEqualTo(new BigDecimal("8.28600851"));
    assertThat(cryptonitTickerRate.getAsk()).isEqualTo(new BigDecimal("604.44900000"));
    assertThat(cryptonitTickerRate.getBid()).isEqualTo(new BigDecimal("584.79532163"));

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