Search in sources :

Example 1 with CCEXMarket

use of org.knowm.xchange.ccex.dto.marketdata.CCEXMarket in project XChange by knowm.

the class CCEXAdapters method adaptToExchangeMetaData.

public static ExchangeMetaData adaptToExchangeMetaData(ExchangeMetaData exchangeMetaData, List<CCEXMarket> products) {
    Map<CurrencyPair, CurrencyPairMetaData> currencyPairs = new HashMap<>();
    Map<CurrencyPair, CurrencyPairMetaData> existingCurrencyPairMetadata = exchangeMetaData.getCurrencyPairs();
    Map<Currency, CurrencyMetaData> currencies = new HashMap<>();
    for (CCEXMarket product : products) {
        BigDecimal minSize = product.getMinTradeSize();
        CurrencyPair pair = adaptCurrencyPair(product);
        CurrencyPairMetaData existingMetaForPair = existingCurrencyPairMetadata.get(pair);
        FeeTier[] existingFeeTiers = null;
        if (existingMetaForPair != null) {
            existingFeeTiers = existingMetaForPair.getFeeTiers();
        }
        CurrencyPairMetaData cpmd = new CurrencyPairMetaData(null, minSize, null, 0, existingFeeTiers);
        currencyPairs.put(pair, cpmd);
        currencies.put(pair.base, null);
        currencies.put(pair.counter, null);
    }
    return new ExchangeMetaData(currencyPairs, currencies, null, null, true);
}
Also used : CurrencyPairMetaData(org.knowm.xchange.dto.meta.CurrencyPairMetaData) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) HashMap(java.util.HashMap) ExchangeMetaData(org.knowm.xchange.dto.meta.ExchangeMetaData) Currency(org.knowm.xchange.currency.Currency) CCEXMarket(org.knowm.xchange.ccex.dto.marketdata.CCEXMarket) FeeTier(org.knowm.xchange.dto.meta.FeeTier) BigDecimal(java.math.BigDecimal) CurrencyPair(org.knowm.xchange.currency.CurrencyPair)

Aggregations

BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 CCEXMarket (org.knowm.xchange.ccex.dto.marketdata.CCEXMarket)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 ExchangeMetaData (org.knowm.xchange.dto.meta.ExchangeMetaData)1 FeeTier (org.knowm.xchange.dto.meta.FeeTier)1