Examples of CurrencyPair


Examples of com.xeiam.xchange.currency.CurrencyPair

    final Map<CurrencyPair, CryptoTradePair> pairs = new HashMap<CurrencyPair, CryptoTradePair>();
    for (JsonNode pairInfo : currencyPairs) {
      final CryptoTradePairType type = CryptoTradePairType.normal_pair;
      String label = pairInfo.fieldNames().next();
      final CurrencyPair pair = CurrencyPairDeserializer.getCurrencyPairFromString(label);
      final CryptoTradePair info = CryptoTradePairDeserializer.getPairFromJsonNode(pairInfo.elements().next());
      final BigDecimal minOrderAMount = info.getMinOrderAmount();
      final int decimals = info.getDecimals();
      pairs.put(pair, new CryptoTradePair(label, type, minOrderAMount, decimals));
    }
    for (JsonNode pairInfo : securityPairs) {
      /*
       * XXX: Currently, no information returned for security_pairs
       */
      final CryptoTradePairType type = CryptoTradePairType.security_pair;
      final String label = pairInfo.asText();
      final CurrencyPair pair = CurrencyPairDeserializer.getCurrencyPairFromString(label);
      pairs.put(pair, new CryptoTradePair(label, type, null, 0));
    }
    return pairs;
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    }
  }

  public Map<String, ANXTicker> getANXTickers(Collection<CurrencyPair> currencyPairs) throws IOException {

    CurrencyPair pathCurrencyPair = null;
    StringBuilder extraCurrencyPairs = new StringBuilder();
    int i = 1;
    for (CurrencyPair currencyPair : currencyPairs) {
      if (i++ == currencyPairs.size()) {
        pathCurrencyPair = currencyPair;
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    }
  }

  public Map<String, ANXDepth> getANXFullOrderBooks(Collection<CurrencyPair> currencyPairs) throws IOException {

    CurrencyPair pathCurrencyPair = null;
    StringBuilder extraCurrencyPairs = new StringBuilder();
    int i = 1;
    for (CurrencyPair currencyPair : currencyPairs) {
      if (i++ == currencyPairs.size()) {
        pathCurrencyPair = currencyPair;
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  public static CurrencyPair adaptCurrencyPair(String krakenCurrencyPair) {

    String firstCurrency = adaptCurrency(krakenCurrencyPair.substring(0, 4));
    String secondCurrency = adaptCurrency(krakenCurrencyPair.substring(4));

    return new CurrencyPair(firstCurrency, secondCurrency);
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    BigDecimal tradableAmount = krakenOrder.getVolume().subtract(krakenOrder.getVolumeExecuted());
    String tradableIdentifier = adaptCurrency(orderDescription.getAssetPair().substring(0, 3));
    String transactionCurrency = adaptCurrency(orderDescription.getAssetPair().substring(3));
    Date timestamp = new Date((long) (krakenOrder.getOpenTimestamp() * 1000L));

    return new LimitOrder(type, tradableAmount, new CurrencyPair(tradableIdentifier, transactionCurrency), id, timestamp, orderDescription.getPrice());
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    String transactionCurrency = adaptCurrency(krakenAssetPair.substring(4));
    Date timestamp = new Date((long) (krakenTrade.getUnixTimestamp() * 1000L));
    BigDecimal averagePrice = krakenTrade.getAverageClosePrice();
    BigDecimal price = (averagePrice == null) ? krakenTrade.getPrice() : averagePrice;

    return new UserTrade(orderType, tradableAmount, new CurrencyPair(tradableIdentifier, transactionCurrency), price, timestamp, tradeId, krakenTrade.getOrderTxId(), krakenTrade.getFee(), transactionCurrency);
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    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
     */
 
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  private static OrderBook internalAdaptDepth(JSONObject jsonObject) throws JSONException {

    JSONObject grouporder = jsonObject.getJSONObject("grouporder");

    String market = grouporder.getString("market");
    CurrencyPair currencyPair = BTCChinaAdapters.adaptCurrencyPair(market);

    JSONArray askArray = grouporder.getJSONArray("ask");
    JSONArray bidArray = grouporder.getJSONArray("bid");

    int askLength = askArray.length();
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    List<CurrencyPair> currencyPairList = new ArrayList<CurrencyPair>();

    for (HitbtcSymbol hitbtcSymbol : hitbtcSymbols.getHitbtcSymbols()) {
      String symbolString = hitbtcSymbol.getSymbol();
      CurrencyPair currencyPair = null;
      if (symbolString.startsWith("DOGE")) {
        String counterSymbol = symbolString.substring(4);
        currencyPair = new CurrencyPair("DOGE", counterSymbol);
      }
      else {
        String base = symbolString.substring(0, 3);
        String counterSymbol = symbolString.substring(3);
        currencyPair = new CurrencyPair(base, counterSymbol);
      }

      currencyPairList.add(currencyPair);
    }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

      OrderType type = o.getSide().equals("buy") ? OrderType.BID : OrderType.ASK;

      String base = o.getSymbol().substring(0, 3);
      String counter = o.getSymbol().substring(3, 6);

      LimitOrder order = new LimitOrder(type, o.getExecQuantity(), new CurrencyPair(base, counter), o.getClientOrderId(), new Date(o.getLastTimestamp()), o.getOrderPrice());

      openOrders.add(order);
    }

    return new OpenOrders(openOrders);
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.