use of org.knowm.xchange.dto.meta.CurrencyMetaData in project XChange by knowm.
the class GlobitexAdapters method adaptToExchangeMetaData.
public static ExchangeMetaData adaptToExchangeMetaData(GlobitexSymbols globitexSymbols) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>();
Map<Currency, CurrencyMetaData> currencies = new HashMap<>();
List<FeeTier> resultFeeTiers = new ArrayList<FeeTier>();
resultFeeTiers.add(new FeeTier(BigDecimal.ONE, new Fee(BigDecimal.valueOf(0.001), BigDecimal.valueOf(0.002))));
globitexSymbols.getSymbols().forEach(globitexSymbol -> {
currencyPairs.put(adaptGlobitexSymbolToCurrencyPair(globitexSymbol), new CurrencyPairMetaData(BigDecimal.valueOf(0.002), globitexSymbol.getSizeMin(), null, globitexSymbol.getPriceIncrement().scale(), resultFeeTiers.toArray(new FeeTier[resultFeeTiers.size()])));
currencies.put(new Currency(convertXBTtoBTC(globitexSymbol.getCurrency())), new CurrencyMetaData(globitexSymbol.getPriceIncrement().scale(), null));
currencies.put(new Currency(convertXBTtoBTC(globitexSymbol.getCommodity())), new CurrencyMetaData(globitexSymbol.getSizeIncrement().scale(), null));
});
return new ExchangeMetaData(currencyPairs, currencies, null, null, null);
}
use of org.knowm.xchange.dto.meta.CurrencyMetaData 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