Package com.xeiam.xchange.currency

Examples of com.xeiam.xchange.currency.CurrencyPair


    return new OrderBook(null, asks, bids);
  }

  public static CurrencyPair adaptCurrencyPair(final String justcoinMarket) {

    return new CurrencyPair(justcoinMarket.substring(0, 3), justcoinMarket.substring(3));
  }
View Full Code Here


  @Override
  public synchronized Collection<CurrencyPair> getExchangeSymbols() throws IOException {

    if (currencyPairs.isEmpty()) {
      for (final JustcoinTicker ticker : justcoin.getTickers()) {
        final CurrencyPair currencyPair = JustcoinAdapters.adaptCurrencyPair(ticker.getId());
        currencyPairs.add(currencyPair);
      }
    }

    return currencyPairs;
View Full Code Here

    List<LimitOrder> limitOrders = new ArrayList<LimitOrder>();
    for (VosTradeOrder vosOrder : openOrders) {
      OrderType orderType = vosOrder.getType().equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;
      String id = Integer.toString(vosOrder.getOrder_id());
      BigDecimal price = vosOrder.getPrice().getValue();
      CurrencyPair currPair = new CurrencyPair(vosOrder.getOrder_currency(), vosOrder.getPayment_currency());

      limitOrders.add(new LimitOrder(orderType, vosOrder.getUnits().getValue(), currPair, id, DateUtils.fromMillisUtc(vosOrder.getOrder_date() / 1000L), price));
    }

    return new OpenOrders(limitOrders);
View Full Code Here

  }

  public static CurrencyPair adaptCurrencyPair(String symbol) {

    return new CurrencyPair(symbol.substring(0, 3), symbol.substring(3, 6));
  }
View Full Code Here

    List<UserTrade> trades = new ArrayList<UserTrade>();
    for (VosTradeOrder order : vosUserTransactions) {

      OrderType orderType = order.getType().equalsIgnoreCase("bid") ? OrderType.BID : OrderType.ASK;
      CurrencyPair currPair = new CurrencyPair(order.getOrder_currency(), order.getPayment_currency());

      final String orderId = String.valueOf(order
          .getOrder_id());
      final Date timestamp = DateUtils.fromMillisUtc(order.getDate_completed() / 1000L);
      final BigDecimal price = order.getPrice().getValue();
View Full Code Here

    BTERMarketInfoWrapper marketInfoWrapper = mapper.readValue(is, BTERMarketInfoWrapper.class);

    Map<CurrencyPair, BTERMarketInfo> marketInfoMap = marketInfoWrapper.getMarketInfoMap();
    assertThat(marketInfoMap).hasSize(2);

    CurrencyPair pair = new CurrencyPair("LTC", "CNY");
    BTERMarketInfo marketInfo = marketInfoMap.get(pair);
    assertThat(marketInfo.getCurrencyPair()).isEqualTo(pair);
    assertThat(marketInfo.getDecimalPlaces()).isEqualTo(2);
    assertThat(marketInfo.getMinAmount()).isEqualTo(".5");
    assertThat(marketInfo.getFee()).isEqualTo("0");
View Full Code Here

    BTERCurrencyPairs currencyPairs = mapper.readValue(is, BTERCurrencyPairs.class);

    Collection<CurrencyPair> pairs = currencyPairs.getPairs();
    assertThat(pairs).hasSize(83);

    assertThat(pairs.contains(new CurrencyPair("TIPS", "CNY"))).isTrue();
  }
View Full Code Here

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    JavaType type = mapper.getTypeFactory().constructParametricType(VosResponse.class, VosDepth.class);
    VosResponse<VosDepth> VaultOfSatoshiDepth = mapper.readValue(is, type);

    List<LimitOrder> asks = VaultOfSatoshiAdapters.adaptOrders(VaultOfSatoshiDepth.getData().getAsks(), new CurrencyPair("BTC", "USD"), "ask", "");

    // Verify all fields filled
    assertThat(asks.get(0).getLimitPrice().doubleValue()).isEqualTo(682.00);
    assertThat(asks.get(0).getType()).isEqualTo(OrderType.ASK);
    assertThat(asks.get(0).getTradableAmount().doubleValue()).isEqualTo(0.22000000);
View Full Code Here

  }

  @Override
  public UserTrades getTradeHistory(Object... arguments) throws ExchangeException, NotAvailableFromExchangeException, NotYetImplementedForExchangeException, IOException {

    CurrencyPair currencyPair = null;
    Long startTime = null;
    Long endTime = null;

    if (arguments != null) {
      switch (arguments.length) {
View Full Code Here

    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

TOP

Related Classes of com.xeiam.xchange.currency.CurrencyPair

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.