private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, DSXMetaData dsxMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = dsxMetaData.getCurrencies().get(symbol) == null ? null : dsxMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(dsxMetaData.amountScale, withdrawalFee)); } }
private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, WexMetaData wexMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = wexMetaData.getCurrencies().get(symbol) == null ? null : wexMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(wexMetaData.amountScale, withdrawalFee)); } }
@Override public String withdrawFunds(Currency currency, BigDecimal amount, String address) throws IOException { boolean useIntl = this.exchange .getExchangeSpecification() .getExchangeSpecificParametersItem("Use_Intl") .equals(true); String currencySymbol = OkCoinAdapters.adaptSymbol( new CurrencyPair(currency, useIntl ? Currency.USD : Currency.CNY)); BigDecimal staticFee = this.exchange.getExchangeMetaData().getCurrencies().get(currency).getWithdrawalFee(); if (staticFee == null) { throw new IllegalArgumentException("Unsupported withdraw currency " + currency); } NumberFormat format = new DecimalFormat("0.####"); // lowest fee is 0.0005 String fee = format.format(staticFee); // Default withdraw target is external address. Use withdraw function in OkCoinAccountServiceRaw // for internal withdraw OKCoinWithdraw result = withdraw(currencySymbol, address, amount, "address", fee); if (result != null) return result.getWithdrawId(); return ""; }
originalMetaData.getCurrencies().get(currencyCode) == null ? null : originalMetaData.getCurrencies().get(currencyCode).getWithdrawalFee(); currencies.put(currencyCode, new CurrencyMetaData(krakenAsset.getScale(), withdrawalFee));
static ExchangeMetaData adaptToExchangeMetaData( HuobiAssetPair[] assetPairs, HuobiAsset[] assets, ExchangeMetaData staticMetaData) { HuobiUtils.setHuobiAssets(assets); HuobiUtils.setHuobiAssetPairs(assetPairs); Map<CurrencyPair, CurrencyPairMetaData> pairsMetaData = staticMetaData.getCurrencyPairs(); Map<CurrencyPair, CurrencyPairMetaData> pairs = new HashMap<>(); for (HuobiAssetPair assetPair : assetPairs) { CurrencyPair pair = adaptCurrencyPair(assetPair.getKey()); pairs.put(pair, adaptPair(assetPair, pairsMetaData.getOrDefault(pair, null))); } Map<Currency, CurrencyMetaData> currenciesMetaData = staticMetaData.getCurrencies(); Map<Currency, CurrencyMetaData> currencies = new HashMap<>(); for (HuobiAsset asset : assets) { Currency currency = adaptCurrency(asset.getAsset()); CurrencyMetaData metadata = currenciesMetaData.getOrDefault(currency, null); BigDecimal withdrawalFee = metadata == null ? null : metadata.getWithdrawalFee(); int scale = metadata == null ? 8 : metadata.getScale(); currencies.put(currency, new CurrencyMetaData(scale, withdrawalFee)); } return new ExchangeMetaData(pairs, currencies, null, null, false); }
basePrecision, currencies.containsKey(pair.base) ? currencies.get(pair.base).getWithdrawalFee() : null)); currencies.put( counterPrecision, currencies.containsKey(pair.counter) ? currencies.get(pair.counter).getWithdrawalFee() : null));
CurrencyMetaData currencyMetaData = exchangeMetaData.getCurrencies().get(pair.base); BigDecimal withdrawalFee = currencyMetaData == null ? null : currencyMetaData.getWithdrawalFee(); currencies.put(pair.base, new CurrencyMetaData(8, withdrawalFee)); currencyMetaData == null ? null : new CurrencyMetaData(8, currencyMetaData.getWithdrawalFee()); currencies.put(pair.counter, withdrawalFee);
originalMetaData.getCurrencies().get(baseCurrencyCode) == null ? null : originalMetaData.getCurrencies().get(baseCurrencyCode).getWithdrawalFee(); BigDecimal quoteWithdrawalFee = originalMetaData.getCurrencies().get(quoteCurrencyCode) == null ? null : originalMetaData.getCurrencies().get(quoteCurrencyCode).getWithdrawalFee();
private static void addCurrencyMetaData( Currency symbol, Map<Currency, CurrencyMetaData> currencies, WexMetaData wexMetaData) { if (!currencies.containsKey(symbol)) { BigDecimal withdrawalFee = wexMetaData.getCurrencies().get(symbol) == null ? null : wexMetaData.getCurrencies().get(symbol).getWithdrawalFee(); currencies.put(symbol, new CurrencyMetaData(wexMetaData.amountScale, withdrawalFee)); } }
@Override public String withdrawFunds(Currency currency, BigDecimal amount, String address) throws IOException { boolean useIntl = this.exchange .getExchangeSpecification() .getExchangeSpecificParametersItem("Use_Intl") .equals(true); String currencySymbol = OkCoinAdapters.adaptSymbol( new CurrencyPair(currency, useIntl ? Currency.USD : Currency.CNY)); BigDecimal staticFee = this.exchange.getExchangeMetaData().getCurrencies().get(currency).getWithdrawalFee(); if (staticFee == null) { throw new IllegalArgumentException("Unsupported withdraw currency " + currency); } NumberFormat format = new DecimalFormat("0.####"); // lowest fee is 0.0005 String fee = format.format(staticFee); // Default withdraw target is external address. Use withdraw function in OkCoinAccountServiceRaw // for internal withdraw OKCoinWithdraw result = withdraw(currencySymbol, address, amount, "address", fee); if (result != null) return result.getWithdrawId(); return ""; }
originalMetaData.getCurrencies().get(currencyCode) == null ? null : originalMetaData.getCurrencies().get(currencyCode).getWithdrawalFee(); currencies.put(currencyCode, new CurrencyMetaData(krakenAsset.getScale(), withdrawalFee));
basePrecision, currencies.containsKey(pair.base) ? currencies.get(pair.base).getWithdrawalFee() : null)); currencies.put( counterPrecision, currencies.containsKey(pair.counter) ? currencies.get(pair.counter).getWithdrawalFee() : null));
originalMetaData.getCurrencies().get(baseCurrencyCode) == null ? null : originalMetaData.getCurrencies().get(baseCurrencyCode).getWithdrawalFee(); BigDecimal quoteWithdrawalFee = originalMetaData.getCurrencies().get(quoteCurrencyCode) == null ? null : originalMetaData.getCurrencies().get(quoteCurrencyCode).getWithdrawalFee();