Package com.xeiam.xchange.cryptotrade.dto

Examples of com.xeiam.xchange.cryptotrade.dto.CryptoTradePairs


  public void testDeserializePairs() throws IOException {

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

    ObjectMapper mapper = new ObjectMapper();
    CryptoTradePairs pairs = mapper.readValue(is, CryptoTradePairs.class);

    Map<CurrencyPair, CryptoTradePair> pairMap = pairs.getPairs();
    assertThat(pairMap).hasSize(4);
    assertThat(pairMap).containsKey(CurrencyPair.BTC_USD);
    assertThat(pairMap).containsKey(CurrencyPair.LTC_BTC);
    assertThat(pairMap).containsKey(new CurrencyPair("AMC", "BTC"));
    assertThat(pairMap).containsKey(new CurrencyPair("BMI", "BTC"));

    CryptoTradePair pair = pairMap.get(CurrencyPair.BTC_USD);
    assertThat(pair.getLabel()).isEqualTo("btc_usd");
    assertThat(pair.getType()).isEqualTo(CryptoTradePairType.normal_pair);
    assertThat(pair.getMinOrderAmount()).isEqualTo("0.001");
    assertThat(pair.getDecimals()).isEqualTo(8);

    pair = pairMap.get(new CurrencyPair("AMC", "BTC"));
    assertThat(pair.getLabel()).isEqualTo("amc_btc");
    assertThat(pair.getType()).isEqualTo(CryptoTradePairType.security_pair);
    /*
     * XXX: Exchange doesn't return minOrderAmount or Decimals for security_pairs
     */
    assertThat(pair.getMinOrderAmount()).isNull();
    assertThat(pair.getDecimals()).isEqualTo(0);

    assertThat(pairs.getStatus()).isEqualTo("success");
    assertThat(pairs.getError()).isNullOrEmpty();
  }
View Full Code Here


    return handleResponse(cryptoTradePair);
  }

  public Map<CurrencyPair, CryptoTradePair> getCryptoTradePairs() throws CryptoTradeException, IOException {

    CryptoTradePairs cryptoPairs = cryptoTradeProxy.getPairs();

    return handleResponse(cryptoPairs).getPairs();
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.cryptotrade.dto.CryptoTradePairs

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.