Package com.xeiam.xchange.anx.v2.dto.marketdata

Examples of com.xeiam.xchange.anx.v2.dto.marketdata.ANXDepthsWrapper


public class WalletHistoryDemo {

  public static void main(String[] args) throws ANXException, IOException {

    Exchange ANXExchange = ANXExamplesUtils.createExchange();
    ANXV2 ANXV2 = RestProxyFactory.createProxy(ANXV2.class, ANXExchange.getExchangeSpecification().getSslUri());
    ParamsDigest signatureCreator = ANXV2Digest.createInstance(ANXExchange.getExchangeSpecification().getSecretKey());

    ANXWalletHistoryWrapper wallethistory = ANXV2.getWalletHistory(ANXExchange.getExchangeSpecification().getApiKey(), signatureCreator, new LongTimeNonceFactory(), "BTC", null);

    System.out.println("WalletHistory: " + wallethistory.getANXWalletHistory().toString());
    for (ANXWalletHistoryEntry entry : wallethistory.getANXWalletHistory().getANXWalletHistoryEntries()) {
      System.out.println(entry.toString());
    }
View Full Code Here


    InputStream is = AccountInfoJSONTest.class.getResourceAsStream("/v2/account/example-accountinfo-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXAccountInfo anxAccountInfo = mapper.readValue(is, ANXAccountInfo.class);

    // Verify that the example data was unmarshalled correctly
    assertThat(anxAccountInfo.getLogin()).isEqualTo("test@anxpro.com");

    // Get Balance
    assertThat(anxAccountInfo.getWallets().getBTC().getBalance().getValue()).isEqualTo(new BigDecimal("100000.01988000"));
    assertThat(anxAccountInfo.getWallets().getUSD().getBalance().getValue()).isEqualTo(new BigDecimal("100000.00000"));
    assertThat(anxAccountInfo.getWallets().getHKD().getBalance().getValue()).isEqualTo(new BigDecimal("99863.07000"));

    assertThat(anxAccountInfo.getWallets().getLTC().getBalance().getValue()).isEqualTo(new BigDecimal("100000.00000000"));
    assertThat(anxAccountInfo.getWallets().getDOGE().getBalance().getValue()).isEqualTo(new BigDecimal("9999781.09457936"));

    // Get Other Balance
    assertThat(anxAccountInfo.getWallets().getBTC().getMaxWithdraw().getValue()).isEqualTo(new BigDecimal("100.00000000"));
    assertThat(anxAccountInfo.getWallets().getBTC().getDailyWithdrawLimit().getValue()).isEqualTo(new BigDecimal("100.00000000"));
  }
View Full Code Here

    InputStream is = ANXAdapterTest.class.getResourceAsStream("/v2/account/example-accountinfo-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXAccountInfo anxAccountInfo = mapper.readValue(is, ANXAccountInfo.class);

    AccountInfo accountInfo = ANXAdapters.adaptAccountInfo(anxAccountInfo);
    assertThat(accountInfo.getUsername()).isEqualTo("test@anxpro.com");
  }
View Full Code Here

    InputStream is = ANXAdapterTest.class.getResourceAsStream("/v2/account/example-accountinfo-data.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    ANXAccountInfo anxAccountInfo = mapper.readValue(is, ANXAccountInfo.class);

    // in Wallet(s), only wallets from ANXAccountInfo.getWallets that contained data are NOT null.
    List<Wallet> wallets = ANXAdapters.adaptWallets(anxAccountInfo.getWallets());
    Assert.assertEquals(22, wallets.size());

    Assert.assertTrue(wallets.contains(new Wallet(Currencies.CAD, new BigDecimal("100000.00000"))));
    Assert.assertTrue(wallets.contains(new Wallet(Currencies.BTC, new BigDecimal("100000.01988000"))));
    Assert.assertTrue(wallets.contains(new Wallet(Currencies.DOGE, new BigDecimal("9999781.09457936"))));
View Full Code Here

  }

  public ANXAccountInfo getANXAccountInfo() throws IOException {

    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

    // Read in the JSON from the example resources
    InputStream is = DepositResponseJSONTest.class.getResourceAsStream("/v2/account/example-deposit-response.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    ANXBitcoinDepositAddress anxBitcoinDepositAddress = mapper.readValue(is, ANXBitcoinDepositAddress.class);

    System.out.println(anxBitcoinDepositAddress.toString());

    // Verify that the example data was unmarshalled correctly
    assertThat(anxBitcoinDepositAddress.getAddress()).isEqualTo("1GAUBau3nKQYJ1uvMWUfWCdEbMTJ1BXFjW");
  }
View Full Code Here

  }

  public ANXBitcoinDepositAddress anxRequestDepositAddress(String currency) throws IOException {

    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

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

    ANXWalletHistoryWrapper anxWalletHistoryWrapper = mapper.readValue(is, ANXWalletHistoryWrapper.class);

    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory() != null);
    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory().getRecords() == 104);
    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory().getCurrentPage() == 1);
    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory().getMaxPage() == 3);
    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory().getMaxResults() == 50);
    Assert.assertTrue(anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries().length == 50);

    Assert.assertEquals("BTC bought: [tid:264f7b7f-f70c-4fc6-ba27-2bcf33b6cd51] 10.00000000 BTC at 280.65500 HKD", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0]
        .getInfo());

    Assert.assertEquals(104, anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getIndex());

    Assert.assertEquals("1394594770000", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getDate());

    Assert.assertEquals("fee", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getType());

    Assert.assertEquals("BTC", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getValue().getCurrency());

    // Assert.assertEquals(new BigDecimal(0),
    // anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getValue().getValue());

    Assert.assertEquals(new BigDecimal("103168.75400000"), anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getBalance().getValue());

    Assert.assertEquals("cc496636-4849-4acf-a390-e4091a5009c3", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getTrade().getOid());

    Assert.assertEquals("264f7b7f-f70c-4fc6-ba27-2bcf33b6cd51", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getTrade().getTid());

    Assert.assertEquals(new BigDecimal("10.00000000"), anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getTrade().getAmount().getValue());

    Assert.assertEquals("market", anxWalletHistoryWrapper.getANXWalletHistory().getANXWalletHistoryEntries()[0].getTrade().getProperties());

  }
View Full Code Here

    Exchange ANXExchange = ANXExamplesUtils.createExchange();
    ANXV2 ANXV2 = RestProxyFactory.createProxy(ANXV2.class, ANXExchange.getExchangeSpecification().getSslUri());
    ParamsDigest signatureCreator = ANXV2Digest.createInstance(ANXExchange.getExchangeSpecification().getSecretKey());

    ANXWalletHistoryWrapper wallethistory = ANXV2.getWalletHistory(ANXExchange.getExchangeSpecification().getApiKey(), signatureCreator, new LongTimeNonceFactory(), "BTC", null);

    System.out.println("WalletHistory: " + wallethistory.getANXWalletHistory().toString());
    for (ANXWalletHistoryEntry entry : wallethistory.getANXWalletHistory().getANXWalletHistoryEntries()) {
      System.out.println(entry.toString());
    }
  }
View Full Code Here

    // Read in the JSON from the example resources
    InputStream is = WithdrawalResponseJSONTest.class.getResourceAsStream("/v2/account/example-withdrawal-response.json");

    // Use Jackson to parse it
    ObjectMapper mapper = new ObjectMapper();
    ANXWithdrawalResponse anxWithdrawalResponse = mapper.readValue(is, ANXWithdrawalResponse.class);

    System.out.println(anxWithdrawalResponse.toString());

    // Verify that the example data was unmarshalled correctly
    // assertThat(anxWithdrawalResponse.getTransactionId()).isEqualTo("9921d2c5abecfd3604e921888b32e48256c914156cc76c4c8eca1ad2709b48e6");
  }
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.anx.v2.dto.marketdata.ANXDepthsWrapper

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.