use of org.knowm.xchange.dto.meta.WalletHealth in project XChange by knowm.
the class PoloniexAdapters method adaptToExchangeMetaData.
public static ExchangeMetaData adaptToExchangeMetaData(Map<String, PoloniexCurrencyInfo> poloniexCurrencyInfo, Map<String, PoloniexMarketData> poloniexMarketData, ExchangeMetaData exchangeMetaData) {
Map<Currency, CurrencyMetaData> currencyMetaDataMap = exchangeMetaData.getCurrencies();
CurrencyMetaData currencyArchetype = currencyMetaDataMap.values().iterator().next();
for (Map.Entry<String, PoloniexCurrencyInfo> entry : poloniexCurrencyInfo.entrySet()) {
Currency ccy = Currency.getInstance(entry.getKey());
if (!currencyMetaDataMap.containsKey(ccy)) {
currencyMetaDataMap.put(ccy, currencyArchetype);
}
CurrencyMetaData currencyMetaData = currencyMetaDataMap.get(ccy);
WalletHealth walletHealth = WalletHealth.ONLINE;
if (entry.getValue().isDelisted() || entry.getValue().isDisabled()) {
walletHealth = WalletHealth.OFFLINE;
}
CurrencyMetaData currencyMetaDataUpdated = new CurrencyMetaData(currencyMetaData.getScale(), entry.getValue().getTxFee(), currencyMetaData.getMinWithdrawalAmount(), walletHealth);
currencyMetaDataMap.put(ccy, currencyMetaDataUpdated);
}
Map<CurrencyPair, CurrencyPairMetaData> marketMetaDataMap = exchangeMetaData.getCurrencyPairs();
CurrencyPairMetaData marketArchetype = marketMetaDataMap.values().iterator().next();
for (String market : poloniexMarketData.keySet()) {
CurrencyPair currencyPair = PoloniexUtils.toCurrencyPair(market);
if (!marketMetaDataMap.containsKey(currencyPair))
marketMetaDataMap.put(currencyPair, marketArchetype);
}
return exchangeMetaData;
}
Aggregations