Package com.xeiam.xchange

Examples of com.xeiam.xchange.ExchangeException


      Object arg0 = args[0];
      if (arg0 instanceof Number) {
        sinceId = ((Number) arg0).longValue();
      }
      else {
        throw new ExchangeException("args[0] must be of type Number!");
      }
    }

    final List<JustcoinPublicTrade> justcoinTrades = super.getTrades(currencyPair.counterSymbol, sinceId);
    return JustcoinAdapters.adaptPublicTrades(currencyPair, justcoinTrades);
View Full Code Here


  }

  protected boolean checkResult(VosResponse<?> response) {

    if (!response.getStatus().equals("success"))
      throw new ExchangeException(response.getMessage());
    else
      return true;
  }
View Full Code Here

    int numberOfTransactions = 100;
    if (args.length > 0) {
      Object arg0 = args[0];
      if (!(arg0 instanceof Integer)) {
        throw new ExchangeException("Argument must be of type Integer!");
      }
      else {
        numberOfTransactions = (Integer) args[0];
      }
    }
View Full Code Here

    // Use the default internal connect
    internalConnect(uri, exchangeEventListener, headers);

    try {
      if (getNextSystemEvent().getEventType() != ExchangeEventType.WELCOME) {
        throw new ExchangeException("Could not connect.");
      }
    } catch (InterruptedException e) {
      throw new ExchangeException("Could not connect.");
    }

    if (configuration.getauthenticateOnConnect()) {
      authenticate();
    }
View Full Code Here

  }

  public void authenticate() {

    if (exchangeSpecification.getUserName() == null || exchangeSpecification.getUserName() == null || exchangeSpecification.getUserName() == null) {
      throw new ExchangeException("Username (UserID), Cookie, and Password cannot be null");
    }
    try {
      Long.valueOf(exchangeSpecification.getUserName());
    } catch (NumberFormatException e) {
      throw new ExchangeException("Username (UserID) must be the string representation of a integer or long value.");
    }

    RequestFactory.CoinfloorAuthenticationRequest authVars =
        new RequestFactory.CoinfloorAuthenticationRequest(Long.valueOf(exchangeSpecification.getUserName()), (String) exchangeSpecification.getExchangeSpecificParametersItem("cookie"),
            exchangeSpecification.getPassword(), exchangeEventListener.getServerNonce());
View Full Code Here

    try {
      try {
        logger.trace("Sent message: " + jsonObjectMapper.writeValueAsString(requestObject));
        send(jsonObjectMapper.writeValueAsString(requestObject));
      } catch (JsonProcessingException e) {
        throw new ExchangeException("Cannot convert Object to String", e);
      }

      CoinfloorExchangeEvent nextEvent = checkNextSystemEvent();
      while (!nextEvent.getEventType().equals(expectedEventType) || nextEvent.getTag() != requestObject.getTag()) {
        switch (nextEvent.getEventType()) {
        case USER_WALLET_UPDATE:
        case ORDER_ADDED:
        case TRADE:
        case ORDER_CANCELED:
        case TICKER:
        case AUTHENTICATION:
        case WELCOME:
          updateEventQueue.put(getNextSystemEvent());
          break;

        }
        synchronized (this) {
          nextEvent = checkNextSystemEvent();
        }
      }
      return getNextSystemEvent();
    } catch (Exception e) {
      throw new ExchangeException("Error processing request", e);
    }
  }
View Full Code Here

    Map<String, Object> jsonData;
    try {
      jsonData = streamObjectMapper.readValue(event.getData(), new TypeReference<Map<String, Object>>() {
      });
    } catch (IOException e) {
      throw new ExchangeException("JSON parse error", e);
    }
    CoinfloorUtils.checkSuccess(jsonData);
    if (jsonData.containsKey("tag")) {
      switch (((Integer) jsonData.get("tag") & (1 << 10) - 1)) {
      case 1:
View Full Code Here

      systemEventQueue.put(event);
      synchronized (systemEventQueue) {
        systemEventQueue.notifyAll();
      }
    } catch (InterruptedException e) {
      throw new ExchangeException("InterruptedException!", e);
    }
  }
View Full Code Here

  }

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

    if (!response.isResult()) {
      throw new ExchangeException(response.getMessage());
    }

    return response;
  }
View Full Code Here

      if (args[0] instanceof Integer) {
        int depthLimit = (Integer) args[0];
        depth = getPoloniexDepth(currencyPair, depthLimit);
      }
      else {
        throw new ExchangeException("Orderbook size argument must be an Integer!");
      }
    }
    if (depth == null) {
      depth = getPoloniexDepth(currencyPair);
    }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.ExchangeException

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.