Package com.xeiam.xchange.dto.account

Examples of com.xeiam.xchange.dto.account.AccountInfo


    Exchange exchange = CexIODemoUtils.createExchange();
    PollingAccountService accountService = exchange.getPollingAccountService();

    // Get the account information
    AccountInfo accountInfo = accountService.getAccountInfo();
    System.out.println("AccountInfo as String: " + accountInfo.toString());
  }
View Full Code Here


  }

  @Test
  public void testAdapter() {

    final AccountInfo acctInfo = JustcoinAdapters.adaptAccountInfo("test", new JustcoinBalance[] { justcoinBalance });

    assertThat(acctInfo.getWallets().size()).isEqualTo(1);
    assertThat(acctInfo.getTradingFee()).isNull();
  }
View Full Code Here

      BigDecimal balance = assetBalancePair.getBalance();

      wallets.add(new Wallet(currency, balance));
    }

    AccountInfo accountInfo = new AccountInfo(null, wallets);
    synchronized (cachedDataSynchronizationObject) {
      cachedAccountInfo = accountInfo;
    }
    resultMap.put("generic", accountInfo);
View Full Code Here

    } catch (IOException e) {
      throw new ExchangeException("JSON parse error", e);
    }

    List<Wallet> newWallets = new ArrayList<Wallet>();
    AccountInfo accountInfo;

    synchronized (cachedDataSynchronizationObject) {
      if (cachedAccountInfo == null) {
        String currency = rawRetObj.getAsset().toString();
        BigDecimal balance = rawRetObj.getBalance();

        newWallets.add(new Wallet(currency, balance));
      }
      else {
        List<Wallet> oldWallets = cachedAccountInfo.getWallets();
        for (Wallet wallet : oldWallets) {
          if (wallet.getCurrency().equals(rawRetObj.getAsset())) {
            String currency = rawRetObj.getAsset().toString();
            BigDecimal balance = rawRetObj.getBalance();

            newWallets.add(new Wallet(currency, balance));
          }
          else {
            newWallets.add(wallet);
          }
        }
      }

      accountInfo = new AccountInfo(null, newWallets);
      cachedAccountInfo = accountInfo;
    }

    resultMap.put("generic", accountInfo);
    resultMap.put("raw", rawRetObj);
View Full Code Here

      String currency = funds.getKey().toUpperCase();
      BigDecimal amount = funds.getValue();
      wallets.add(new Wallet(currency, amount));
    }

    return new AccountInfo("", wallets);
  }
View Full Code Here

    raw((HitbtcAccountServiceRaw) accountService);
  }

  private static void generic(PollingAccountService accountService) throws IOException {

    AccountInfo accountInfo = accountService.getAccountInfo();
    System.out.println(accountInfo);
  }
View Full Code Here

    MyFunds myFunds = getCampBXAccountInfo();
    logger.debug("myFunds = {}", myFunds);

    if (!myFunds.isError()) {
      // TODO move to adapter class
      return new AccountInfo(exchangeSpecification.getUserName(), Arrays.asList(new Wallet("BTC", myFunds.getTotalBTC()), new Wallet("USD", myFunds.getTotalUSD())));
    }
    else {
      throw new ExchangeException("Error calling getAccountInfo(): " + myFunds.getError());
    }
  }
View Full Code Here

    // Adapt to XChange DTOs
    Wallet usdWallet = new Wallet(Currencies.USD, bitstampBalance.getUsdBalance());
    Wallet btcWallet = new Wallet(Currencies.BTC, bitstampBalance.getBtcBalance());

    return new AccountInfo(userName, bitstampBalance.getFee(), Arrays.asList(usdWallet, btcWallet));
  }
View Full Code Here

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

    AccountInfo accountInfo = BitstampAdapters.adaptAccountInfo(bitstampBalance, "Joe Mama");
    assertThat(accountInfo.getUsername()).isEqualTo("Joe Mama");
    assertThat(accountInfo.getTradingFee()).isEqualTo(new BigDecimal("0.5000"));
    assertThat(accountInfo.getWallets().get(0).getCurrency()).isEqualTo("USD");
    assertThat(accountInfo.getWallets().get(0).getBalance().toString()).isEqualTo("172.87");
    assertThat(accountInfo.getWallets().get(1).getCurrency()).isEqualTo("BTC");
    assertThat(accountInfo.getWallets().get(1).getBalance().toString()).isEqualTo("6.99990000");
  }
View Full Code Here

    raw((CoinbaseAccountService) accountService);
  }

  private static void generic(PollingAccountService accountService) throws IOException {

    AccountInfo accountInfo = accountService.getAccountInfo();
    System.out.println("Account Info: " + accountInfo);

    String depositAddress = accountService.requestDepositAddress(Currencies.BTC);
    System.out.println("Deposit Address: " + depositAddress);
View Full Code Here

TOP

Related Classes of com.xeiam.xchange.dto.account.AccountInfo

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.