use of org.knowm.xchange.lgo.dto.currency.LgoCurrency in project XChange by knowm.
the class LgoAdapters method adaptMetadata.
public static ExchangeMetaData adaptMetadata(ExchangeMetaData metaData, LgoProducts products, LgoCurrencies currencies) {
Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = metaData.getCurrencyPairs();
Map<Currency, CurrencyMetaData> currency = metaData.getCurrencies();
for (LgoCurrency lgoCurrency : currencies.getCurrencies()) {
currency.put(Currency.getInstance(lgoCurrency.getCode()), new CurrencyMetaData(lgoCurrency.getDecimals(), null));
}
for (LgoProduct product : products.getProducts()) {
BigDecimal minAmount = product.getBase().getLimits().getMin();
BigDecimal maxAmount = product.getBase().getLimits().getMax();
Integer baseScale = currency.get(Currency.getInstance(product.getBase().getId())).getScale();
BigDecimal increment = product.getQuote().getIncrement().stripTrailingZeros();
currencyPairs.put(toPair(product), new CurrencyPairMetaData(null, minAmount, maxAmount, null, null, baseScale, increment.scale(), null, new FeeTier[0], increment, Currency.USD, true));
}
return metaData;
}
Aggregations