Examples of ExchangeException


Examples of com.xeiam.xchange.ExchangeException

      PoloniexTradeResponse response =
          poloniex.sell(apiKey, signatureCreator, String.valueOf(nextNonce()), limitOrder.getTradableAmount().toPlainString(), limitOrder.getLimitPrice().toPlainString(), PoloniexUtils
              .toPairString(limitOrder.getCurrencyPair()));
      return response;
    } catch (PoloniexException e) {
      throw new ExchangeException(e.getError());
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

    OpenOrders openOrders = PoloniexAdapters.adaptPoloniexOpenOrders(returnOpenOrders());
    for (LimitOrder order : openOrders.getOpenOrders()) {
      if (order.getId().equals(orderId)) {
        HashMap<String, String> response = poloniex.cancelOrder(apiKey, signatureCreator, String.valueOf(nextNonce()), orderId, PoloniexUtils.toPairString(order.getCurrencyPair()));
        if (response.containsKey("error")) {
          throw new ExchangeException(response.get("error"));
        }
        else {
          return response.get("success").toString().equals(new Integer(1).toString()) ? true : false;
        }
      }
    }

    throw new ExchangeException("Unable to find order #" + orderId);

  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

  public List<Wallet> getWallets() throws IOException {

    HashMap<String, String> response = poloniex.returnBalances(apiKey, signatureCreator, String.valueOf(nextNonce()));

    if (response.containsKey("error")) {
      throw new ExchangeException(response.get("error"));
    }
    else {
      return PoloniexAdapters.adaptPoloniexBalances(response);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

  public String getDepositAddress(String currency) throws IOException {

    HashMap<String, String> response = poloniex.returnDepositAddresses(apiKey, signatureCreator, String.valueOf(nextNonce()));

    if (response.containsKey("error")) {
      throw new ExchangeException(response.get("error"));
    }
    if (response.containsKey(currency)) {
      return response.get(currency);
    }
    else {
      throw new ExchangeException("Poloniex did not return a deposit address for " + currency);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

  public List<ANXTrade> getANXTrades(CurrencyPair currencyPair, Long sinceTimeStamp) throws IOException {

    try {
      return anxV2.getTrades(currencyPair.baseSymbol, currencyPair.counterSymbol, sinceTimeStamp).getANXTrades();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling getTrades(): " + e.getError(), e);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

  protected <R extends CryptoTradeBaseResponse> R handleResponse(final R response) {

    final String status = response.getStatus();
    final String error = response.getError();
    if ((status != null && status.equalsIgnoreCase("error")) || (error != null && !error.isEmpty())) {
      throw new ExchangeException(error);
    }

    return response;
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

    try {
      ANXAccountInfoWrapper anxAccountInfoWrapper = anxV2.getAccountInfo(exchangeSpecification.getApiKey(), signatureCreator, getNonce());
      return anxAccountInfoWrapper.getANXAccountInfo();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling getAccountInfo(): " + e.getError(), e);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

      ANXWithdrawalResponseWrapper anxWithdrawalResponseWrapper =
          anxV2.withdrawBtc(exchangeSpecification.getApiKey(), signatureCreator, getNonce(), currency, address, amount.multiply(new BigDecimal(ANXUtils.BTC_VOLUME_AND_AMOUNT_INT_2_DECIMAL_FACTOR_2))
              .intValue(), 1, false, false);
      return anxWithdrawalResponseWrapper.getAnxWithdrawalResponse();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling withdrawFunds(): " + e.getError(), e);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

    try {
      ANXBitcoinDepositAddressWrapper anxBitcoinDepositAddressWrapper = anxV2.requestDepositAddress(exchangeSpecification.getApiKey(), signatureCreator, getNonce(), currency);
      return anxBitcoinDepositAddressWrapper.getAnxBitcoinDepositAddress();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling requestBitcoinDepositAddress(): " + e.getError(), e);
    }
  }
View Full Code Here

Examples of com.xeiam.xchange.ExchangeException

    String priceWindow = "";

    if (args.length == 1) {
      Object arg0 = args[0];
      if (!(arg0 instanceof String)) {
        throw new ExchangeException("priceWindow argument must be a String!");
      }
      else {
        priceWindow = (String) arg0;
      }
    }
    else {
      throw new ExchangeException("Exactly 1 String arguments is necessary: the priceWindow!");
    }

    // Request data
    BitcoiniumOrderbook bitcoiniumOrderbook = getBitcoiniumOrderbook(currencyPair.baseSymbol, currencyPair.counterSymbol, priceWindow);
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.