com.xeiam.xchange.dto.account.AccountInfo.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中com.xeiam.xchange.dto.account.AccountInfo.<init>()方法的一些代码示例,展示了AccountInfo.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AccountInfo.<init>()方法的具体详情如下:
包路径:com.xeiam.xchange.dto.account.AccountInfo
类名称:AccountInfo
方法名:<init>

AccountInfo.<init>介绍

暂无

代码示例

代码示例来源:origin: com.xeiam.xchange/xchange-cryptotrade

public static AccountInfo adaptAccountInfo(String userName, CryptoTradeAccountInfo accountInfo) {
 List<Wallet> wallets = new ArrayList<Wallet>();
 for (Entry<String, BigDecimal> fundsEntry : accountInfo.getFunds().entrySet())
  wallets.add(new Wallet(fundsEntry.getKey().toUpperCase(), fundsEntry.getValue()));
 return new AccountInfo(userName, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-kraken

public static AccountInfo adaptBalance(Map<String, BigDecimal> krakenBalance, String username) {
 Map<String, Wallet> wallets = new ConcurrentHashMap<String, Wallet>();
 for (Entry<String, BigDecimal> balancePair : krakenBalance.entrySet()) {
  String currency = adaptCurrency(balancePair.getKey());
  Wallet wallet = new Wallet(currency, balancePair.getValue());
  wallets.put(currency, wallet);
 }
 return new AccountInfo(username, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-btce

public static AccountInfo adaptAccountInfo(BTCEAccountInfo btceAccountInfo) {
 List<Wallet> wallets = new ArrayList<Wallet>();
 Map<String, BigDecimal> funds = btceAccountInfo.getFunds();
 for (String lcCurrency : funds.keySet()) {
  String currency = lcCurrency.toUpperCase();
  wallets.add(new Wallet(currency, funds.get(lcCurrency)));
 }
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-cointrader

public static AccountInfo adaptAccountInfo(Map<String, CointraderBalance> balances, String userName) {
 HashMap<String, Wallet> wallets = new HashMap<String, Wallet>();
 for (String currency : balances.keySet()) {
  CointraderBalance blc = balances.get(currency);
  wallets.put(currency, new Wallet(currency, blc.getTotal(), blc.getAvailable()));
 }
 return new AccountInfo(userName, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bittrex

public static AccountInfo adaptAccountInfo(List<BittrexBalance> balances) {
 List<Wallet> wallets = new ArrayList<Wallet>(balances.size());
 for (BittrexBalance balance : balances) {
  // FIXME: the second parameter should be balance.getBalance(),
  // keep it balance.getAvailable() for safe reason,
  // will be fixed in XChange 4.0.0.
  wallets.add(new Wallet(balance.getCurrency().toUpperCase(), balance.getAvailable(), balance.getAvailable()));
 }
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitfinex

public static AccountInfo adaptAccountInfo(BitfinexBalancesResponse[] response) {
 List<Wallet> wallets = new ArrayList<Wallet>(response.length);
 for (BitfinexBalancesResponse balance : response) {
  if ("exchange".equals(balance.getType())) {
   wallets.add(new Wallet(balance.getCurrency().toUpperCase(), balance.getAmount(), balance.getAvailable()));
  }
 }
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-bleutrade

public static AccountInfo adaptBleutradeBalances(List<BleutradeBalance> bleutradeBalances) {
 List<Wallet> wallets = new ArrayList<Wallet>();
 for (BleutradeBalance bleutradeBalance : bleutradeBalances) {
  // FIXME: the second parameter should be balance.getBalance(),
  // keep it balance.getAvailable() for safe reason,
  // will be fixed in XChange 4.0.0.
  wallets.add(new Wallet(bleutradeBalance.getCurrency(), bleutradeBalance.getAvailable(), bleutradeBalance.getAvailable()));
 }
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-mtgox

/**
 * Adapts a MtGoxAccountInfo to a AccountInfo
 * 
 * @param mtGoxAccountInfo
 * @return
 */
public static AccountInfo adaptAccountInfo(MtGoxAccountInfo mtGoxAccountInfo) {
 // Adapt to XChange DTOs
 AccountInfo accountInfo = new AccountInfo(mtGoxAccountInfo.getLogin(), MtGoxAdapters.adaptWallets(mtGoxAccountInfo.getWallets()));
 return accountInfo;
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitcointoyou

/**
 * Adapts a BitcoinToYouBaseTradeApiResult<BitcoinToYouBalance[]> to an AccountInfo
 *
 * @param accountInfo The BitcoinToYou accountInfo
 * @param userName The user name
 * @return The account info
 */
public static AccountInfo adaptAccountInfo(BitcoinToYouBaseTradeApiResult<BitcoinToYouBalance[]> accountInfo, String userName) {
 BitcoinToYouBalance[] balances = accountInfo.getTheReturn();
 List<Wallet> wallets = new ArrayList<Wallet>(5);
 for (BitcoinToYouBalance balance : balances) {
  wallets.add(new Wallet(balance.getCurrency(), balance.getBalanceAvailable(), balance.getCurrency() + " balance"));
 }
 return new AccountInfo(userName, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-mtgox

/**
 * Adapts a MtGoxAccountInfo to a AccountInfo
 * 
 * @param mtGoxAccountInfo
 * @return
 */
public static AccountInfo adaptAccountInfo(MtGoxAccountInfo mtGoxAccountInfo) {
 // Adapt to XChange DTOs
 AccountInfo accountInfo = new AccountInfo(mtGoxAccountInfo.getLogin(), MtGoxAdapters.adaptWallets(mtGoxAccountInfo.getWallets()));
 return accountInfo;
}

代码示例来源:origin: com.xeiam.xchange/xchange-therock

public static AccountInfo adaptAccountInfo(List<TheRockBalance> balances, String userName) {
 Map<String, Wallet> wallets = new HashMap<>();
 for (TheRockBalance blc : balances) {
  wallets.put(blc.getCurrency(), new Wallet(blc.getCurrency(), blc.getBalance(), blc.getTradingBalance()));
 }
 return new AccountInfo(userName, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-coinbaseex

public static AccountInfo adaptAccountInfo(CoinbaseExAccount[] coinbaseExAccountInfo) {
 List<Wallet> wallets = new ArrayList<Wallet>(coinbaseExAccountInfo.length);
 for (int i = 0; i < coinbaseExAccountInfo.length; i++) {
  CoinbaseExAccount account = coinbaseExAccountInfo[i];
  wallets.add(new Wallet(account.getCurrency(), account.getBalance(), account.getAvailable(), account.getHold()));
 }
 return new AccountInfo(coinbaseExAccountInfo[0].getProfile_id(), wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-hitbtc

public static AccountInfo adaptAccountInfo(HitbtcBalance[] accountInfoRaw) {
 List<Wallet> wallets = new ArrayList<Wallet>(accountInfoRaw.length);
 for (int i = 0; i < accountInfoRaw.length; i++) {
  HitbtcBalance balance = accountInfoRaw[i];
  Wallet wallet = new Wallet(balance.getCurrencyCode(), balance.getCash().add(balance.getReserved()), balance.getCash(), balance.getReserved(),
    balance.getCurrencyCode());
  wallets.add(wallet);
 }
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-mexbt

public static AccountInfo adaptAccountInfo(String username, MeXBTBalanceResponse balanceResponse) {
 Map<String, Wallet> wallets = new LinkedHashMap<String, Wallet>(balanceResponse.getCurrencies().length);
 for (MeXBTBalance balance : balanceResponse.getCurrencies()) {
  Wallet wallet = new Wallet(balance.getName(), balance.getBalance().add(balance.getHold()), balance.getBalance(), balance.getHold());
  wallets.put(wallet.getCurrency(), wallet);
 }
 return new AccountInfo(username, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-huobi

public static AccountInfo adaptAccountInfo(BitVcAccountInfo a) {
 Wallet cny = new Wallet(CNY, a.getAvailableCnyDisplay().add(a.getFrozenCnyDisplay()).subtract(a.getLoanCnyDisplay()), "available");
 Wallet btc = new Wallet(BTC, a.getAvailableBtcDisplay().add(a.getFrozenBtcDisplay()).subtract(a.getLoanBtcDisplay()), "available");
 Wallet ltc = new Wallet(LTC, a.getAvailableLtcDisplay().add(a.getFrozenLtcDisplay()).subtract(a.getLoanLtcDisplay()), "available");
 // loaned wallets
 Wallet cnyLoan = new Wallet(CNY, a.getLoanCnyDisplay(), "loan");
 Wallet btcLoan = new Wallet(BTC, a.getLoanBtcDisplay(), "loan");
 Wallet ltcLoan = new Wallet(LTC, a.getLoanLtcDisplay(), "loan");
 List<Wallet> wallets = Arrays.asList(cny, btc, ltc, cnyLoan, btcLoan, ltcLoan);
 return new AccountInfo(null, wallets);
}

代码示例来源:origin: com.xeiam.xchange/xchange-okcoin

public static AccountInfo adaptAccountInfoFutures(OkCoinFuturesUserInfoCross futureUserInfo) {
 OkCoinFuturesInfoCross info = futureUserInfo.getInfo();
 OkcoinFuturesFundsCross btcFunds = info.getBtcFunds();
 OkcoinFuturesFundsCross ltcFunds = info.getLtcFunds();
 Wallet btcWallet = new Wallet(BTC, btcFunds.getAccountRights());
 Wallet ltcWallet = new Wallet(LTC, ltcFunds.getAccountRights());
 return new AccountInfo(null, Arrays.asList(emptyUsdWallet, btcWallet, ltcWallet));
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitso

public static AccountInfo adaptAccountInfo(BitsoBalance bitsoBalance, String userName) {
 // Adapt to XChange DTOs
 Wallet mxnWallet = new Wallet(Currencies.MXN, bitsoBalance.getMxnBalance(), bitsoBalance.getMxnAvailable(), bitsoBalance.getMxnReserved());
 Wallet btcWallet = new Wallet(Currencies.BTC, bitsoBalance.getBtcBalance(), bitsoBalance.getBtcAvailable(), bitsoBalance.getBtcReserved());
 return new AccountInfo(userName, Arrays.asList(mxnWallet, btcWallet));
}

代码示例来源:origin: com.xeiam.xchange/xchange-anx

/**
 * Adapts a ANXAccountInfo to a AccountInfo
 *
 * @param anxAccountInfo
 * @return
 */
public static AccountInfo adaptAccountInfo(ANXAccountInfo anxAccountInfo) {
 // Adapt to XChange DTOs
 AccountInfo accountInfo = new AccountInfo(anxAccountInfo.getLogin(), percentToFactor(anxAccountInfo.getTradeFee()),
   ANXAdapters.adaptWallets(anxAccountInfo.getWallets()));
 return accountInfo;
}

代码示例来源:origin: com.xeiam.xchange/xchange-taurus

public static AccountInfo adaptAccountInfo(TaurusBalance taurusBalance, String userName) {
 Wallet cadWallet = new Wallet(Currencies.CAD, taurusBalance.getCadBalance(), taurusBalance.getCadAvailable(), taurusBalance.getCadReserved());
 Wallet btcWallet = new Wallet(Currencies.BTC, taurusBalance.getBtcBalance(), taurusBalance.getBtcAvailable(), taurusBalance.getBtcReserved());
 return new AccountInfo(userName, taurusBalance.getFee(), Arrays.asList(cadWallet, btcWallet));
}

代码示例来源:origin: com.xeiam.xchange/xchange-bitcoincentral

/**
 * Adapts a BitcoinCentralAccountInfo to a AccountInfo
 */
public static AccountInfo adaptAccountInfo(BitcoinCentralAccountInfo accountInfo, String userName) {
 Wallet eurWallet = new Wallet("EUR", BigMoney.of(CurrencyUnit.EUR, accountInfo.getEur()));
 Wallet btcWallet = Wallet.createInstance("BTC", accountInfo.getBtc());
 Wallet usdWallet = new Wallet("GBP", BigMoney.of(CurrencyUnit.CAD, accountInfo.getGbp()));
 Wallet inrWallet = new Wallet("USD", BigMoney.of(CurrencyUnit.getInstance("INR"), accountInfo.getUsd()));
 return new AccountInfo(userName, Arrays.asList(btcWallet, usdWallet, eurWallet, inrWallet));
}

相关文章

微信公众号

最新文章

更多