Search in sources :

Example 1 with LgoCurrency

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;
}
Also used : CurrencyPairMetaData(org.knowm.xchange.dto.meta.CurrencyPairMetaData) LgoCurrency(org.knowm.xchange.lgo.dto.currency.LgoCurrency) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) LgoProduct(org.knowm.xchange.lgo.dto.product.LgoProduct) Currency(org.knowm.xchange.currency.Currency) LgoCurrency(org.knowm.xchange.lgo.dto.currency.LgoCurrency) FeeTier(org.knowm.xchange.dto.meta.FeeTier) BigDecimal(java.math.BigDecimal) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Aggregations

BigDecimal (java.math.BigDecimal)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)1 CurrencyPairMetaData (org.knowm.xchange.dto.meta.CurrencyPairMetaData)1 FeeTier (org.knowm.xchange.dto.meta.FeeTier)1 LgoCurrency (org.knowm.xchange.lgo.dto.currency.LgoCurrency)1 LgoProduct (org.knowm.xchange.lgo.dto.product.LgoProduct)1