use of org.knowm.xchange.bittrex.dto.marketdata.BittrexCurrency in project XChange by knowm.
the class BittrexAdapters method adaptMetaData.
public static void adaptMetaData(List<BittrexSymbol> rawSymbols, List<BittrexCurrency> bittrexCurrencies, Map<CurrencyPair, Fee> dynamicTradingFees, ExchangeMetaData metaData) {
List<CurrencyPair> currencyPairs = BittrexAdapters.adaptCurrencyPairs(rawSymbols);
for (CurrencyPair currencyPair : currencyPairs) {
CurrencyPairMetaData defaultCurrencyPairMetaData = metaData.getCurrencyPairs().get(currencyPair);
BigDecimal resultingFee = null;
// Prioritize dynamic fee
if (dynamicTradingFees != null) {
Fee fee = dynamicTradingFees.get(currencyPair);
if (fee != null) {
resultingFee = fee.getMakerFee();
}
} else {
if (defaultCurrencyPairMetaData != null) {
resultingFee = defaultCurrencyPairMetaData.getTradingFee();
}
}
CurrencyPairMetaData newCurrencyPairMetaData;
if (defaultCurrencyPairMetaData != null) {
newCurrencyPairMetaData = new CurrencyPairMetaData(resultingFee, defaultCurrencyPairMetaData.getMinimumAmount(), defaultCurrencyPairMetaData.getMaximumAmount(), defaultCurrencyPairMetaData.getPriceScale(), defaultCurrencyPairMetaData.getVolumeScale(), defaultCurrencyPairMetaData.getFeeTiers(), defaultCurrencyPairMetaData.getTradingFeeCurrency());
} else {
newCurrencyPairMetaData = new CurrencyPairMetaData(resultingFee, null, null, null, null, null, null);
}
metaData.getCurrencyPairs().put(currencyPair, newCurrencyPairMetaData);
}
for (BittrexCurrency bittrexCurrency : bittrexCurrencies) {
WalletHealth walletHealth = WalletHealth.UNKNOWN;
if (ONLINE.equals(bittrexCurrency.getStatus())) {
walletHealth = WalletHealth.ONLINE;
} else if (OFFLINE.equals(bittrexCurrency.getStatus())) {
walletHealth = WalletHealth.OFFLINE;
}
metaData.getCurrencies().put(bittrexCurrency.getSymbol(), new CurrencyMetaData(1, BigDecimal.valueOf(bittrexCurrency.getTxFee()), null, walletHealth));
}
}
Aggregations