Package com.xeiam.xchange.anx.v2.service.polling

Examples of com.xeiam.xchange.anx.v2.service.polling.ANXAccountServiceRaw


    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    ANXTicker anxTicker = mapper.readValue(is, ANXTicker.class);
    //
    System.out.println(anxTicker.toString());

    // Verify that the example data was unmarshalled correctly
    Assert.assertEquals(new BigDecimal("725.38123"), anxTicker.getHigh().getValue());
    Assert.assertEquals(new BigDecimal("380.00000"), anxTicker.getLow().getValue());
    Assert.assertEquals(new BigDecimal("429.34018"), anxTicker.getAvg().getValue());
    Assert.assertEquals(new BigDecimal("429.34018"), anxTicker.getVwap().getValue());
    Assert.assertEquals(new BigDecimal("7.00000000"), anxTicker.getVol().getValue());
    Assert.assertEquals(new BigDecimal("725.38123"), anxTicker.getLast().getValue());
    Assert.assertEquals(new BigDecimal("38.85148"), anxTicker.getBuy().getValue());
    Assert.assertEquals(new BigDecimal("897.25596"), anxTicker.getSell().getValue());
    Assert.assertEquals(1393388594814000L, anxTicker.getNow());

  }
View Full Code Here


  }

  public ANXTicker getANXTicker(CurrencyPair currencyPair) throws IOException {

    try {
      ANXTickerWrapper anxTickerWrapper = anxV2.getTicker(currencyPair.baseSymbol, currencyPair.counterSymbol);
      return anxTickerWrapper.getAnxTicker();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling getTicker(): " + e.getError(), e);
    }
  }
View Full Code Here

        ANXTicker anxTicker = getANXTicker(pathCurrencyPair);
        Map<String, ANXTicker> ticker = new HashMap<String, ANXTicker>();
        ticker.put(pathCurrencyPair.baseSymbol + pathCurrencyPair.counterSymbol, anxTicker);
        return ticker;
      }
      ANXTickersWrapper anxTickerWrapper = anxV2.getTickers(pathCurrencyPair.baseSymbol, pathCurrencyPair.counterSymbol, extraCurrencyPairs.toString());
      return anxTickerWrapper.getAnxTickers();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling getTicker(): " + e.getError(), e);
    }
  }
View Full Code Here

    List<ANXTrade> anxTrades = anxTradesWrapper.getANXTrades();

    assertThat(anxTrades).hasSize(2);

    ANXTrade anxTrade = anxTrades.get(0);
    assertThat(anxTrade.getAmount()).isEqualTo("0.25");
    assertThat(anxTrade.getAmountInt()).isEqualTo(25000000);
    assertThat(anxTrade.getItem()).isEqualTo("BTC");
    assertThat(anxTrade.getPrice()).isEqualTo("655");
    assertThat(anxTrade.getPriceInt()).isEqualTo(65500000);
    assertThat(anxTrade.getPriceCurrency()).isEqualTo("USD");
    assertThat(anxTrade.getPrimary()).isEqualTo("true");
    assertThat(anxTrade.getProperties()).isEqualTo("Not Supported");
    assertThat(anxTrade.getTid()).isEqualTo(1402189342525L);
    assertThat(anxTrade.getTradeType()).isEqualTo("bid");
  }
View Full Code Here

    InputStream is = TickerJSONTest.class.getResourceAsStream("/v2/marketdata/example-trades-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    ANXTradesWrapper anxTradesWrapper = mapper.readValue(is, ANXTradesWrapper.class);
    List<ANXTrade> anxTrades = anxTradesWrapper.getANXTrades();

    Trades trades = ANXAdapters.adaptTrades(anxTrades);
    assertThat(trades.getlastID()).isEqualTo(1402189349725L);

    List<Trade> tradeList = trades.getTrades();
View Full Code Here

    InputStream is = TickerJSONTest.class.getResourceAsStream("/v2/marketdata/example-trades-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();

    ANXTradesWrapper anxTradesWrapper = mapper.readValue(is, ANXTradesWrapper.class);

    List<ANXTrade> anxTrades = anxTradesWrapper.getANXTrades();

    assertThat(anxTrades).hasSize(2);

    ANXTrade anxTrade = anxTrades.get(0);
    assertThat(anxTrade.getAmount()).isEqualTo("0.25");
View Full Code Here

  }

  public ANXGenericResponse placeANXMarketOrder(MarketOrder marketOrder) throws IOException {

    try {
      ANXGenericResponse anxGenericResponse =
          anxV2.placeOrder(exchangeSpecification.getApiKey(), signatureCreator, getNonce(), marketOrder.getCurrencyPair().baseSymbol, marketOrder.getCurrencyPair().counterSymbol, marketOrder
              .getType().equals(Order.OrderType.BID) ? "bid" : "ask", marketOrder.getTradableAmount(), null);
      return anxGenericResponse;
    } catch (ANXException e) {
      throw new ExchangeException("Error calling placeMarketOrder(): " + e.getError(), e);
View Full Code Here

  }

  public ANXGenericResponse placeANXLimitOrder(CurrencyPair currencyPair, String type, BigDecimal amount, BigDecimal price) throws IOException {

    try {
      ANXGenericResponse anxGenericResponse =
          anxV2.placeOrder(exchangeSpecification.getApiKey(), signatureCreator, getNonce(), currencyPair.baseSymbol, currencyPair.counterSymbol, type, amount, price);

      return anxGenericResponse;
    } catch (ANXException e) {
      throw new ExchangeException("Error calling placeLimitOrder(): " + e.getError(), e);
View Full Code Here

  public ANXGenericResponse cancelANXOrder(String orderId, String baseCurrency, String counterCurrency) throws IOException {

    try {

      ANXGenericResponse anxGenericResponse = anxV2.cancelOrder(exchangeSpecification.getApiKey(), signatureCreator, getNonce(), orderId, baseCurrency, counterCurrency);
      return anxGenericResponse;
    } catch (ANXException e) {
      throw new ExchangeException("Error calling cancelOrder(): " + e.getError(), e);
    }
  }
View Full Code Here

  }

  public ANXOpenOrder[] getANXOpenOrders(String baseCurrency, String counterCurrency) throws IOException {

    try {
      ANXOpenOrderWrapper anxOpenOrderWrapper = anxV2.getOpenOrders(ANXUtils.urlEncode(exchangeSpecification.getApiKey()), signatureCreator, getNonce(), baseCurrency, counterCurrency);
      return anxOpenOrderWrapper.getANXOpenOrders();
    } catch (ANXException e) {
      throw new ExchangeException("Error calling getOpenOrders(): " + e.getError(), e);
    }
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.anx.v2.service.polling.ANXAccountServiceRaw

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.