Examples of CurrencyPair


Examples of com.xeiam.xchange.currency.CurrencyPair

    if (rootNode.size() == 1) {
      final ObjectNode dataNode = (ObjectNode) rootNode.get(0);
      final Iterator<Entry<String, JsonNode>> tickersArray = dataNode.fields();
      while (tickersArray.hasNext()) {
        final Entry<String, JsonNode> tickerData = tickersArray.next();
        final CurrencyPair pair = CurrencyPairDeserializer.getCurrencyPairFromString(tickerData.getKey());
        final CryptoTradeTicker ticker = CryptoTradeTickerDeserializer.getTickerFromJsonNode(tickerData.getValue());
        tickers.put(pair, ticker);
      }
    }
    return tickers;
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

   */
  public static LimitOrder adaptOrder(BigDecimal amount, BigDecimal price, String tradedCurrency, String transactionCurrency, String orderTypeString, String id, Date timestamp) {

    // place a limit order
    OrderType orderType = SIDE_BID.equalsIgnoreCase(orderTypeString) ? OrderType.BID : OrderType.ASK;
    CurrencyPair currencyPair = adaptCurrencyPair(tradedCurrency, transactionCurrency);

    LimitOrder limitOrder = new LimitOrder(orderType, amount, currencyPair, id, timestamp, price);

    return limitOrder;

View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  public static Trade adaptTrade(ANXTrade anxTrade) {

    OrderType orderType = adaptSide(anxTrade.getTradeType());
    BigDecimal amount = anxTrade.getAmount();
    BigDecimal price = anxTrade.getPrice();
    CurrencyPair currencyPair = adaptCurrencyPair(anxTrade.getItem(), anxTrade.getPriceCurrency());
    Date dateTime = DateUtils.fromMillisUtc(anxTrade.getTid());
    final String tradeId = String.valueOf(anxTrade.getTid());

    return new Trade(orderType, amount, currencyPair, price, dateTime, tradeId);
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    BigDecimal ask = anxTicker.getSell().getValue();
    BigDecimal high = anxTicker.getHigh().getValue();
    BigDecimal low = anxTicker.getLow().getValue();
    Date timestamp = new Date(anxTicker.getNow() / 1000);

    CurrencyPair currencyPair = adaptCurrencyPair(anxTicker.getVol().getCurrency(), anxTicker.getAvg().getCurrency());

    return new Ticker.Builder().currencyPair(currencyPair).last(last).bid(bid).ask(ask).high(high).low(low).volume(volume).timestamp(timestamp).build();

  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  }

  public static CurrencyPair adaptCurrencyPair(String tradeCurrency, String priceCurrency) {

    return new CurrencyPair(tradeCurrency, priceCurrency);
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  }

  private static UserTrade adaptUserTrade(ANXTradeResult t) {

    BigDecimal tradedCurrencyFillAmount = t.getTradedCurrencyFillAmount();
    CurrencyPair currencyPair = adaptCurrencyPair(t.getCurrencyPair());
    BigDecimal price = t.getSettlementCurrencyFillAmount().divide(tradedCurrencyFillAmount, PRICE_SCALE, BigDecimal.ROUND_HALF_EVEN);
    OrderType type = adaptSide(t.getSide());
    // for fees, getWalletHistory should be used.
    return new UserTrade(type, tradedCurrencyFillAmount, currencyPair, price, t.getTimestamp(), t.getTradeId(), t.getOrderId(), null, null);
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    if ("DOGEBTC".equalsIgnoreCase(currencyPairRaw))
      return CurrencyPair.DOGE_BTC;
    else if (currencyPairRaw.length() != 6)
      throw new IllegalArgumentException("Unrecognized currency pair " + currencyPairRaw);
    else
      return new CurrencyPair(currencyPairRaw.substring(0, 3), currencyPairRaw.substring(3));
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

  public static Map<CurrencyPair, Ticker> adaptTickers(BTCChinaTicker btcChinaTicker) {

    Map<CurrencyPair, Ticker> tickers = new LinkedHashMap<CurrencyPair, Ticker>(btcChinaTicker.size());
    for (Map.Entry<String, BTCChinaTickerObject> entry : btcChinaTicker.entrySet()) {
      CurrencyPair currencyPair = adaptCurrencyPairFromTickerMarketKey(entry.getKey());
      tickers.put(currencyPair, adaptTicker(entry.getValue(), currencyPair));
    }
    return tickers;
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    if (certainCurrencyPairOrders != null) {
      limitOrders.addAll(adaptOrders(certainCurrencyPairOrders, specifiedCurrencyPair));
    }

    for (Map.Entry<String, BTCChinaOrder[]> entry : orders.entrySet()) {
      CurrencyPair currencyPair = adaptCurrencyPairFromOrdersMarketKey(entry.getKey());
      limitOrders.addAll(adaptOrders(entry.getValue(), currencyPair));
    }

    return limitOrders;
  }
View Full Code Here

Examples of com.xeiam.xchange.currency.CurrencyPair

    if (!(type.startsWith("buy") || type.startsWith("sell"))) {
      return null;
    }

    final OrderType orderType = type.startsWith("buy") ? OrderType.BID : OrderType.ASK;
    final CurrencyPair currencyPair = adaptCurrencyPair(transaction.getMarket());

    final BigDecimal amount;
    final BigDecimal money;
    final int scale;

    if (currencyPair.equals(CurrencyPair.BTC_CNY)) {
      amount = transaction.getBtcAmount().abs();
      money = transaction.getCnyAmount().abs();
      scale = BTCChinaExchange.CNY_SCALE;
    }
    else if (currencyPair.equals(CurrencyPair.LTC_CNY)) {
      amount = transaction.getLtcAmount().abs();
      money = transaction.getCnyAmount().abs();
      scale = BTCChinaExchange.CNY_SCALE;
    }
    else if (currencyPair.equals(CurrencyPair.LTC_BTC)) {
      amount = transaction.getLtcAmount().abs();
      money = transaction.getBtcAmount().abs();
      scale = BTCChinaExchange.BTC_SCALE;
    }
    else {
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.