use of org.knowm.xchange.binance.dto.account.AssetDetail in project XChange by knowm.
the class BinanceAdapters method adaptCurrencyMetaData.
static CurrencyMetaData adaptCurrencyMetaData(Map<Currency, CurrencyMetaData> currencies, Currency currency, Map<String, AssetDetail> assetDetailMap, int precision) {
if (assetDetailMap != null) {
AssetDetail asset = assetDetailMap.get(currency.getCurrencyCode());
if (asset != null) {
BigDecimal withdrawalFee = asset.getWithdrawFee().stripTrailingZeros();
BigDecimal minWithdrawalAmount = new BigDecimal(asset.getMinWithdrawAmount()).stripTrailingZeros();
WalletHealth walletHealth = getWalletHealth(asset.isDepositStatus(), asset.isWithdrawStatus());
return new CurrencyMetaData(precision, withdrawalFee, minWithdrawalAmount, walletHealth);
}
}
BigDecimal withdrawalFee = null;
BigDecimal minWithdrawalAmount = null;
if (currencies.containsKey(currency)) {
CurrencyMetaData currencyMetaData = currencies.get(currency);
withdrawalFee = currencyMetaData.getWithdrawalFee();
minWithdrawalAmount = currencyMetaData.getMinWithdrawalAmount();
}
return new CurrencyMetaData(precision, withdrawalFee, minWithdrawalAmount);
}
use of org.knowm.xchange.binance.dto.account.AssetDetail in project XChange by knowm.
the class BinanceExchange method remoteInit.
@Override
public void remoteInit() {
try {
BinanceMarketDataService marketDataService = (BinanceMarketDataService) this.marketDataService;
exchangeInfo = marketDataService.getExchangeInfo();
BinanceAccountService accountService = (BinanceAccountService) getAccountService();
Map<String, AssetDetail> assetDetailMap = null;
if (!usingSandbox() && isAuthenticated()) {
// not available in sndbox
assetDetailMap = accountService.getAssetDetails();
}
postInit(assetDetailMap);
} catch (Exception e) {
throw new ExchangeException("Failed to initialize: " + e.getMessage(), e);
}
}
use of org.knowm.xchange.binance.dto.account.AssetDetail in project XChange by knowm.
the class BinanceUsExchange method remoteInit.
@Override
public void remoteInit() {
BinanceMarketDataService marketDataService = (BinanceMarketDataService) this.marketDataService;
try {
exchangeInfo = marketDataService.getExchangeInfo();
} catch (IOException e) {
e.printStackTrace();
}
Map<String, AssetDetail> assetDetailMap = null;
postInit(assetDetailMap);
}
Aggregations